User:DonQuich: Difference between revisions

From Civilization Modding Wiki
Jump to navigationJump to search
m (testing my bot)
m (testing my bot)
Line 2: Line 2:


Test if a string starts with a specified prefix (UTF-8 friendly)
Test if a string starts with a specified prefix (UTF-8 friendly)
==Syntax==
==Syntax==
<code>'''bool''' Locale.StartsWith('''string''' base_string, '''string''' prefix)</code>
<code>'''bool''' Locale.StartsWith('''string''' base_string, '''string''' prefix)</code>
Line 13: Line 14:
:''prefix''
:''prefix''
::The prefix to test with.
::The prefix to test with.


==Examples==
==Examples==

Revision as of 14:04, 9 August 2012

This page is a part of the Lua and UI Reference.

Test if a string starts with a specified prefix (UTF-8 friendly)

Syntax

bool Locale.StartsWith(string base_string, string prefix)


Return Value

Returns true if base_string starts with prefix, false otherwise.

Parameters

base_string
The string to test against.
prefix
The prefix to test with.


Examples

local test = Locale.StartsWith("Civilization", "Civ");
print(test); -- prints true