首页 / base / oaString

oaString

模块: oapy._oa._base 导入: from oapy._oa import _base

概览

oaStringoapy 暴露的字符串工具类型,用于与 OpenAccess API 之间传递字符串值。

本页汇总 oaString 当前在 oapy 中可用的 Python 接口。

详细说明

The oaString class is a utility class that is used to pass string arguments to and from OpenAccess functions。 The oaString class is always constructed and destroyed by the caller and is passed by reference to OpenAccess functions。 This calling style means that the lifetime of the string is determined by the caller。 Callers are never given pointers to strings stored in an OpenAccess database。 An oaString supports many common operations one may need to do on a string: copy constructors and assignment operators support the copying of strings logical operators support the comparison of strings there are functions that support getting the length of a string, converting the string to a float or int value (if appropriate), and converting the string to all uppercase or all lowercase。

构造函数

_base.oaString()

obj = _base.oaString()

_base.oaString(length)

obj = _base.oaString(length)

_base.oaString(initialValue)

obj = _base.oaString(initialValue)

_base.oaString(initialValue, length)

obj = _base.oaString(initialValue, length)

_base.oaString(s)

obj = _base.oaString(s)

方法总览

状态 Python 调用
obj.operator=(c)
obj.operator=(str)
obj.operator=(str)
obj.operator+=(c)
obj.operator+=(str)
obj.operator+=(str)
obj.operator<(str)
obj.operator>(str)
obj.operator==(str)
obj.operator<=(str)
obj.operator>=(str)
obj.operator!=(str)
obj.getLength()
obj.isEmpty()
obj.toDouble()
obj.toInt()
obj.toUpper()
obj.toLower()
obj.resize(size)
obj.getSize()
obj.operator[](i)
obj.operator[](i)
obj.index(c, offset=0)
obj.substr(sub, offset=0)
obj.isEqual(str, ignoreCase)
obj.format(size, formatStr, ...)
obj.format(formatStr, ...)
obj.format(formatStr, args)

方法说明

obj.operator=(c)

绑定状态: 已绑定

Python 调用: obj.operator=(c)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator=(c)

obj.operator=(str)

绑定状态: 已绑定

Python 调用: obj.operator=(str)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator=(str)

obj.operator=(str)

绑定状态: 已绑定

Python 调用: obj.operator=(str)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator=(str)

obj.operator+=(c)

绑定状态: 已绑定

Python 调用: obj.operator+=(c)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator+=(c)

obj.operator+=(str)

绑定状态: 已绑定

Python 调用: obj.operator+=(str)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator+=(str)

obj.operator+=(str)

绑定状态: 已绑定

Python 调用: obj.operator+=(str)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator+=(str)

obj.operator<(str)

绑定状态: 已绑定

Python 调用: obj.operator<(str)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator<(str)

obj.operator>(str)

绑定状态: 已绑定

Python 调用: obj.operator>(str)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator>(str)

obj.operator==(str)

绑定状态: 已绑定

Python 调用: obj.operator==(str)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator==(str)

obj.operator<=(str)

绑定状态: 已绑定

Python 调用: obj.operator<=(str)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator<=(str)

obj.operator>=(str)

绑定状态: 已绑定

Python 调用: obj.operator>=(str)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator>=(str)

obj.operator!=(str)

绑定状态: 已绑定

Python 调用: obj.operator!=(str)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator!=(str)

obj.getLength()

绑定状态: 已绑定

Python 调用: obj.getLength()

This function returns the length of this string。 The value represents the number of characters in this string excluding the trailing NULL character。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.getLength()

obj.isEmpty()

绑定状态: 已绑定

Python 调用: obj.isEmpty()

This function returns a boolean that indicates whether this string is empty or not。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.isEmpty()

obj.toDouble()

绑定状态: 已绑定

Python 调用: obj.toDouble()

This function converts the contents of this oaString to a double value and returns it。 See the system function atof for formatting details。

返回

  • 0.0 if the conversion fails。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.toDouble()

obj.toInt()

绑定状态: 已绑定

Python 调用: obj.toInt()

This function converts the contents of this oaString to an integer value and returns it。 See the system function atoi for details。

返回

  • Zero if the conversion fails。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.toInt()

obj.toUpper()

绑定状态: 已绑定

Python 调用: obj.toUpper()

This function converts the contents of this oaString so that all of the alphabetic characters are in uppercase。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.toUpper()

obj.toLower()

绑定状态: 已绑定

Python 调用: obj.toLower()

This function changes the contents of this oaString so that all of the alphabetic characters are in lowercase。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.toLower()

obj.resize(size)

绑定状态: 已绑定

Python 调用: obj.resize(size)

This function increases the amount of space allocated by this string to newSize。 The contents of the string is retained。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.resize(size)

obj.getSize()

绑定状态: 已绑定

Python 调用: obj.getSize()

This function returns the size of the space allocated for this oaString。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.getSize()

obj.operator[](i)

绑定状态: 已绑定

Python 调用: obj.operator[](i)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator[](i)

obj.operator[](i)

绑定状态: 已绑定

Python 调用: obj.operator[](i)

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.operator[](i)

obj.index(c, offset=0)

绑定状态: 已绑定

Python 调用: obj.index(c, offset=0)

This function searches this string and returns an index to the first occurrence of the specified character。 If the character is not found, the index to the terminating NULL character is returned。 You can specify an optional initial offset into the string from where the search will begin。

参数

  • c: The character to find。
  • offset: The initial offset into the string。

返回

  • An integer representing the position of the character in this string。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.index(c, offset=0)

obj.substr(sub, offset=0)

绑定状态: 已绑定

Python 调用: obj.substr(sub, offset=0)

This function searches this oaString and returns the index to the first occurrence of the specified substring sub。 If the substring is not found, index of the terminating NULL character is returned。 You can specify an optional initial offset into the string from which the search will begin。

参数

  • sub: The substring to find。
  • offset: The initial offset into the string。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.substr(sub, offset=0)

obj.isEqual(str, ignoreCase)

绑定状态: 已绑定

Python 调用: obj.isEqual(str, ignoreCase)

This function compares this oaString with the oaString str, either with or without case sensitivity, and returns true if they are equal。

参数

  • str: The string to be compared。
  • ignoreCase: Ignore case or not when comparing。

Python 示例

from oapy._oa import _base

left = _base.oaString("Demo")
right = _base.oaString("demo")
left.isEqual(right, True)

obj.format(size, formatStr, ...)

绑定状态: 未绑定

Python 调用: obj.format(size, formatStr, ...)

This function formats this string according to the format specification given in formatStr。 The format specification has the same form as the format argument for printf。 Note: If the number of va_list args is 1 and the type of the argument is char , compilers may call the wrong function, which can result in incorrect behavior or a crash。 To avoid problems, the argument should be cast to (const char)。

Python 绑定未直接暴露 varargs 版本,建议改用 Python 字符串格式化。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.format(size, formatStr, ...)

obj.format(formatStr, ...)

绑定状态: 未绑定

Python 调用: obj.format(formatStr, ...)

This function formats this string according to the format specification given in formatStr。 The format specification has the same form as the format argument for printf。 Note: If the number of variable arguments to this function is 1 and the type of the argument is char , compilers may call the wrong function, which can result in incorrect behavior or a crash。 To avoid problems, the argument should be cast to (const char), for example, oaString mystring; char str[200]= "Hello" ; mystring。 format ( "%s" , ( const char *) str);。

Python 绑定未直接暴露 varargs 版本,建议改用 Python 字符串格式化。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.format(formatStr, ...)

obj.format(formatStr, args)

绑定状态: 未绑定

Python 调用: obj.format(formatStr, args)

This function increases the size of this string to the specified size and formats it according to the format specification given in formatStr。 The format specification has the same form as the format argument for printf。 If the length of the formatted string is larger than the specified size, this function will not resize this string to fit the formatted string。 This function should only be used when the size is known to be bounded。

Python 绑定未直接暴露 varargs 版本,建议改用 Python 字符串格式化。

Python 示例

from oapy._oa import _base

value = _base.oaString("demo")
value.format(formatStr, args)