Difference between revisions of "LlStringToBase64"

From Second Life Wiki
Jump to navigation Jump to search
m (Replaced old <LSL> block with <source lang="lsl2">)
 
(8 intermediate revisions by 3 users not shown)
Line 2: Line 2:
|func_id=260|func_sleep=0.0|func_energy=10.0
|func_id=260|func_sleep=0.0|func_energy=10.0
|func=llStringToBase64|return_type=string|p1_type=string|p1_name=str
|func=llStringToBase64|return_type=string|p1_type=string|p1_name=str
|func_footnote
|func_footnote=If extra bits are needed to complete the last base64 symbol, those extra bits will be zero.<br>To go in the other direction, use [[llBase64ToString]].
|func_desc
|func_desc
|return_text=that is the {{LSLGC|Base64}} representation of the '''str'''
|Return_text={{LSLGC|Base64}} representation of the {{LSLPT|str}} interpreted as an UTF-8 byte sequence
|spec
|spec
|caveats
|caveats
|constants
|constants
|examples
|examples=
<source lang="lsl2">integer getStringBytes(string msg) {
    return (llStringLength((string)llParseString2List(llStringToBase64(msg), ["="], [])) * 3) >> 2;
}</source>
|helpers
|helpers
|also_functions=*{{LSLG|llBase64ToString}}
|also_functions=
*{{LSLG|llBase64ToInteger}}
{{LSL DefineRow||[[llBase64ToString]]}}
*{{LSLG|llIntegerToBase64}}
{{LSL DefineRow||[[llBase64ToInteger]]}}
*{{LSLG|llXorBase64StringsCorrect}}
{{LSL DefineRow||[[llIntegerToBase64]]}}
{{LSL DefineRow||[[llXorBase64]]}}
|also_events
|also_events
|also_tests
|also_tests
|also_articles
|also_articles
|notes
|notes
|permission
|negative_index
|sort=StringToBase64
|sort=StringToBase64
|cat1=Base64
|cat1=Base64
|cat2=String
|cat2=String
|cat3
|cat3=Encoding
|cat4
|cat4
}}
}}

Latest revision as of 12:38, 22 January 2015

Summary

Function: string llStringToBase64( string str );

Returns the string Base64 representation of the str interpreted as an UTF-8 byte sequence

• string str

If extra bits are needed to complete the last base64 symbol, those extra bits will be zero.
To go in the other direction, use llBase64ToString.

Examples

integer getStringBytes(string msg) {
    return (llStringLength((string)llParseString2List(llStringToBase64(msg), ["="], [])) * 3) >> 2;
}

See Also

Deep Notes

Search JIRA for related Issues

Signature

function string llStringToBase64( string str );