Difference between revisions of "Zh/Documentation/DevGuide/ProUNO/Basic/Case Sensitivity"
From Apache OpenOffice Wiki
< Zh | Documentation
(New page: {{Documentation/DevGuide/ProUNOTOC/Zh |ProUNO2c=block |Basic=block |ShowPrevNext=block |PrevPage=Zh/Documentation/DevGuide/ProUNO/Basic/Mapping of Enums and Constant Groups |NextPage=Zh/Do...) |
m |
||
Line 6: | Line 6: | ||
|NextPage=Zh/Documentation/DevGuide/ProUNO/Basic/Exception Handling | |NextPage=Zh/Documentation/DevGuide/ProUNO/Basic/Exception Handling | ||
}} | }} | ||
− | + | {{Documentation/DevGuideLanguages|Documentation/DevGuide/ProUNO/Basic/{{SUBPAGENAME}}}} | |
{{DISPLAYTITLE:区分大小写}} | {{DISPLAYTITLE:区分大小写}} | ||
Latest revision as of 02:55, 14 May 2009
Basic 通常不区分大小写。但是,这并不总是适用于 UNO 与 Basic 之间的通信。要避免大小写问题,编写 UNO 相关代码时,将 Basic 看作区分大小写。这有利于将 Basic 程序转换为另一种语言,而且 Basic 代码变得更容易阅读和理解。下面讨论可能发生的问题。
如果 UNO 对象属性、方法和结构成员使用大小写不同的标识符,这些标识符被视为相同。
Dim ALocale As New com.sun.star.lang.Locale alocale.language = "en" ' Ok MsgBox aLocale.Language ' Ok
例外情况是,如果通过前面所述的 com.sun.star.container.XNameAccess 获取一个 Basic 属性,就必须完全按照 API 引用中那样编写其名称。Basic 将该名称用作一个字符串参数,使用其方法访问 com.sun.star.container.XNameAccess 时不会解释这一字符串参数。
' 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). |