GetStringLength

From NWN Lexicon
Jump to: navigation, search



GetStringLength(string)

Determines the length of a string.

int GetStringLength(
    string sString
);

Parameters

sString

Target string to determine length of.


Description

Returns the length of sString. Returns -1 on error.



Remarks

This functions is supposed to return -1 on error, but I can't think when you could ever get this function to err. Both of the following scenarios return 0, not -1:

string sBla="";
int nLength=GetStringLength(sBla);

---

string sBla;
int nLength=GetStringLength(sBla);


Version

1.61

Example

void main()
{
    string sStr = "Hello World";
    int nLen = GetStringLength(sStr);
    //nLen is now 11
}

See Also



 author: Daniel Beckman, editor: Lilac Soul