Core Function StrNew
From Sputnik Wiki
(Difference between revisions)
Line 1: | Line 1: | ||
<pre> | <pre> | ||
− | StrNew( <char>, <length> | + | StrNew( <char>, <length> ) |
</pre> | </pre> | ||
=== Description === | === Description === | ||
− | Create a new string of a given length filled with a given char | + | Create a new string of a given length filled with a given char. |
=== Parameters === | === Parameters === | ||
Line 11: | Line 11: | ||
==== char ==== | ==== char ==== | ||
+ | What char should populate the new string. | ||
==== length ==== | ==== length ==== | ||
− | + | How big the new string should be. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
=== Return Value === | === Return Value === | ||
− | Success: | + | Success: The new string. |
Failure: null | Failure: null | ||
Line 31: | Line 25: | ||
=== Remarks === | === Remarks === | ||
− | + | None. | |
− | + | ||
− | + | ||
=== Example === | === Example === | ||
Line 49: | Line 41: | ||
// The purpose of this function is just to make it more | // The purpose of this function is just to make it more | ||
// simple to create a string for use in Fixed() and (char*) etc | // simple to create a string for use in Fixed() and (char*) etc | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Core Function]] | [[Category:Core Function]] |
Revision as of 19:14, 18 September 2015
StrNew( <char>, <length> )
Contents |
Description
Create a new string of a given length filled with a given char.
Parameters
char
What char should populate the new string.
length
How big the new string should be.
Return Value
Success: The new string.
Failure: null
Remarks
None.
Example
Normal string
$Str = StrNew('T', 15); $Str[0] = 'A'; // Set first char to A $Str[1] = 'A'; // Set second char to B echo $Str; // Prints: ABTTTTTTTTTTTTT // Of course you could just make the string like // $Str = "ABTTTTTTTTTTTTT"; // OR // $Str = "AB" . ('T' x 13); // The purpose of this function is just to make it more // simple to create a string for use in Fixed() and (char*) etc