「Stringクラス」の版間の差分
提供:AB開発Wiki
ナビゲーションに移動検索に移動
編集の要約なし |
|||
50行目: | 50行目: | ||
==== StrPtr ==== | ==== StrPtr ==== | ||
Function StrPtr() As LPSTR | |||
==== LPSTR変換演算子 ==== | ==== LPSTR変換演算子 ==== | ||
==== Insert ==== | ==== Insert ==== | ||
Function Insert(startIndex As Long, lpszText As LPSTR) As Long | |||
==== Remove ==== | ==== Remove ==== | ||
Function Remove(startIndex As Long) As Long | |||
Function Remove(startIndex As Long, count As Long) As Long | |||
==== Replace ==== | ==== Replace ==== | ||
Sub Replace(oldChar As Byte, newChar As Byte) | |||
Sub Replace(ByRef oldStr As String, ByRef newStr As String) | |||
Sub Replace(oldStr As PCSTR, newStr As PCSTR) | |||
Sub Replace(oldStr As PCSTR, oldLen As Long, newStr As PCSTR, newLen As Long) | |||
==== Operator + ==== | ==== Operator + ==== | ||
Function Operator+ (lpszText As LPSTR) As String | |||
Function Operator+ (ByRef objString As String) As String | |||
==== Operator & ==== | ==== Operator & ==== | ||
Function Operator& (lpszText As LPSTR) As String | |||
Function Operator& (ByRef objString As String) As String | |||
==== Append ==== | ==== Append ==== | ||
Sub Append(lpszText As LPSTR, textLength As Long) | |||
Sub Append(text As LPSTR) | |||
Sub Append(ByRef str As String) | |||
==== Concat ==== | ==== Concat ==== | ||
Function Concat(lpszText As LPSTR, textLength As Long) As String | |||
==== Operator [] ==== | ==== Operator [] ==== | ||
Function Operator[] (n As Long) As Byte | |||
==== Operator []= ==== | ==== Operator []= ==== | ||
Sub Operator[]= (n As Long, c As Byte) | |||
==== IndexOf ==== | ==== IndexOf ==== | ||
Function IndexOf(lpszText As LPSTR) As Long | |||
Function IndexOf(lpszText As LPSTR, startIndex As Long) As Long | |||
Function IndexOf(lpszText As LPSTR, startIndex As Long, count As Long) As Long | |||
==== LastIndexOf ==== | ==== LastIndexOf ==== | ||
Function LastIndexOf(lpszText As LPSTR) As Long | |||
Function LastIndexOf(lpszText As LPSTR, startIndex As Long) As Long | |||
Function LastIndexOf(lpszText As LPSTR, startIndex As Long, count As Long) As Long | |||
==== StartsWith ==== | ==== StartsWith ==== | ||
Function StartsWith(lpszText As LPSTR) As BOOL | |||
==== EndsWith ==== | ==== EndsWith ==== | ||
Function EndsWith(lpszText As LPSTR) As BOOL | |||
==== SubString ==== | ==== SubString ==== | ||
Function SubString(startIndex As Long) As String | |||
Function SubString(startIndex As Long, length As Long) As String | |||
==== IsNullOrEmpty ==== | ==== IsNullOrEmpty ==== | ||
Function IsNullOrEmpty() As BOOL |
2006年9月30日 (土) 11:41時点における版
文字列を扱うクラスです。
クラスの機能
メンバ・プロパティ
Chars
Stringが保持している文字列へのポインタです。これを通じて内容の読み取り・書き込みを行うことができます。
Length
Stringが保持している文字列の長さを表しています。基本的に書き換えないでください。
メソッド
コンストラクタ
Stringインスタンスを初期化します。
Sub String()
デフォルトコンストラクタ)空文字列を作ります。
Sub String(ByRef initStr As String)
(コピーコンストラクタ)initStrの内容で初期化します。
Sub String(ByVal initStr As *Byte)
initStrの内容で初期化します。initStrはヌル終端の文字列を指定します。
デストラクタ
Stringインスタンスの破壊時に呼ばれます。
Sub ~String()
文字列のメモリを解放します。
代入
Stringオブジェクトに文字列を割り当てます。
Sub Operator = (ByRef text As String) Sub Operator = (ByVal text As *Byte)
Assign(text)と同じです。
Assign
Stringオブジェクトに文字列を割り当てます。
Sub Assign(ByRef text As String) Sub Assign(ByVal text As *Byte) Sub Assign(ByVal text As *Byte, ByVal length As Long)
textの内容をこのStringインスタンスへコピーします。
- Stringを引数に取るものは、text.length文字コピーします。
- *Byte単独を引数に取るものは、lstrlen(text)文字コピーします。
- lengthを引数に取るものは、length文字分コピーします。
Swap
Sub Swap(ByRef x As String)
ZeroString
Function ZeroString(allocLength As Long) As LPSTR
StrPtr
Function StrPtr() As LPSTR
LPSTR変換演算子
Insert
Function Insert(startIndex As Long, lpszText As LPSTR) As Long
Remove
Function Remove(startIndex As Long) As Long Function Remove(startIndex As Long, count As Long) As Long
Replace
Sub Replace(oldChar As Byte, newChar As Byte) Sub Replace(ByRef oldStr As String, ByRef newStr As String) Sub Replace(oldStr As PCSTR, newStr As PCSTR) Sub Replace(oldStr As PCSTR, oldLen As Long, newStr As PCSTR, newLen As Long)
Operator +
Function Operator+ (lpszText As LPSTR) As String Function Operator+ (ByRef objString As String) As String
Operator &
Function Operator& (lpszText As LPSTR) As String Function Operator& (ByRef objString As String) As String
Append
Sub Append(lpszText As LPSTR, textLength As Long) Sub Append(text As LPSTR) Sub Append(ByRef str As String)
Concat
Function Concat(lpszText As LPSTR, textLength As Long) As String
Operator []
Function Operator[] (n As Long) As Byte
Operator []=
Sub Operator[]= (n As Long, c As Byte)
IndexOf
Function IndexOf(lpszText As LPSTR) As Long Function IndexOf(lpszText As LPSTR, startIndex As Long) As Long Function IndexOf(lpszText As LPSTR, startIndex As Long, count As Long) As Long
LastIndexOf
Function LastIndexOf(lpszText As LPSTR) As Long Function LastIndexOf(lpszText As LPSTR, startIndex As Long) As Long Function LastIndexOf(lpszText As LPSTR, startIndex As Long, count As Long) As Long
StartsWith
Function StartsWith(lpszText As LPSTR) As BOOL
EndsWith
Function EndsWith(lpszText As LPSTR) As BOOL
SubString
Function SubString(startIndex As Long) As String Function SubString(startIndex As Long, length As Long) As String
IsNullOrEmpty
Function IsNullOrEmpty() As BOOL