Case Sensitivity

From Apache OpenOffice Wiki
Jump to: navigation, search



Generally Basic is case insensitive. However, this does not always apply to the communication between UNO and Basic. To avoid problems with case sensitivity write the UNO related code as if Basic was case sensitive. This facilitates the translation of a Basic program to another language, and Basic code becomes easier to read and understand. The following discusses problems that might occur.

Identifiers that differ in case are considered to be identical when they are used with UNO object properties, methods and struct members.

  Dim ALocale As New com.sun.star.lang.Locale
  alocale.language = "en"     ' Ok
  MsgBox aLocale.Language     ' Ok

The exceptions to this is if a Basic property is obtained through com.sun.star.container.XNameAccess as described above, its name has to be written exactly as it is in the API reference. Basic uses the name as a string parameter that is not interpreted when accessing com.sun.star.container.XNameAccess using its methods.

  ' oNameAccessible is an object that supports XNameAccess
 
  ' including the names "Value1", "Value2"
  x = oNameAccessible.Value1 ' Ok
  y = oNameAccessible.VaLUe2 ' Runtime Error, Value2 is not written correctly
 
  ' is the same as
 
  x = oNameAccessible.getByName( "Value1" ) ' Ok
  y = oNameAccessible.getByName( "VaLUe2" ) ' Runtime Error, Value2 is not written correctly
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages