Core Function RevHex

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> RevHex( <expression> ) </pre> === Description === Reverse a string of hex digits. === Parameters === ==== expression ==== The string containing hex digits to use. ===...")
 
(Example)
Line 30: Line 30:
 
say "old: $old"; // Prints 1A2B3C4D
 
say "old: $old"; // Prints 1A2B3C4D
 
say "new: $new"; // Prints 4D3C2B1A
 
say "new: $new"; // Prints 4D3C2B1A
 +
</syntaxhighlight>
 +
 +
You can also modify the string directly by using the call directly on the variable
 +
 +
<syntaxhighlight lang="sputnik">
 +
$var = "1A2B3C4D";
 +
say $var; // Prints 1A2B3C4D
 +
$var->RevHex();
 +
say $var; // Prints 4D3C2B1A
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
[[Category:Core Function]]
 
[[Category:Core Function]]

Revision as of 16:25, 24 August 2013

RevHex( <expression> )

Contents

Description

Reverse a string of hex digits.

Parameters

expression

The string containing hex digits to use.

Return Value

Success: Returns reversed hex string.

Failure: Returns empty string.

Remarks

None.

Example

$old = "1A2B3C4D";
$new = RevHex($old);
say "old: $old"; // Prints 1A2B3C4D
say "new: $new"; // Prints 4D3C2B1A

You can also modify the string directly by using the call directly on the variable

$var = "1A2B3C4D";
say $var; // Prints 1A2B3C4D
$var->RevHex();
say $var; // Prints 4D3C2B1A
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox