34 ultimix.string_utilities.str_replace =
function( Search , Replace , Subject )
36 return( Subject.split( Search ).join( Replace ) );
50 ultimix.string_utilities.print_record =
function( Format , Record )
54 Format =
ultimix.string_utilities.str_replace(
'[' + i +
']' , Record[ i ] , Format );
69 ultimix.string_utilities.trail_data =
function( Data , EncodedData )
71 switch( Data.length % 3 )
74 EncodedData = EncodedData.slice( 0 , -2 ) +
'==';
77 EncodedData = EncodedData.slice( 0 , -1 ) +
'=';
81 return( EncodedData );
93 ultimix.string_utilities.base64_encode =
function( Data )
95 var b64 =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
96 var o1 , o2 , o3 , h1 , h2 , h3 , h4 , bits , i = 0 , EncodedData =
'';
99 o1 = Data.charCodeAt( i++ );
100 o2 = Data.charCodeAt( i++ );
101 o3 = Data.charCodeAt( i++ );
102 bits = o1 << 16 | o2 << 8 | o3;
103 h1 = bits >> 18 & 0x3f;
104 h2 = bits >> 12 & 0x3f;
105 h3 = bits >> 6 & 0x3f;
107 EncodedData += b64.charAt( h1 ) + b64.charAt( h2 ) + b64.charAt( h3 ) + b64.charAt( h4 );
109 while ( i < Data.length );
111 return(
ultimix.string_utilities.trail_data( Data , EncodedData ) );
131 ultimix.string_utilities.decoded_char =
function( o1 , o2 , o3 , h3 , h4 )
135 return( String.fromCharCode( o1 ) );
139 return( String.fromCharCode( o1 , o2 ) );
143 return( String.fromCharCode( o1 , o2 , o3 ) );
156 ultimix.string_utilities.base64_decode =
function( Data )
158 var b64 =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
159 var o1 , o2 , o3 , h1 , h2 , h3 , h4 , bits , i = 0 , DecodedData =
'';
162 h1 = b64.indexOf( Data.charAt( i++ ) );
163 h2 = b64.indexOf( Data.charAt( i++ ) );
164 h3 = b64.indexOf( Data.charAt( i++ ) );
165 h4 = b64.indexOf( Data.charAt( i++ ) );
166 bits = h1<<18 | h2<<12 | h3<<6 | h4;
167 o1 = bits>>16 & 0xff;
171 DecodedData +=
ultimix.string_utilities.decoded_char( o1 , o2 , o3 , h3 , h4 );
173 while( i < Data.length );
175 return( DecodedData );
187 ultimix.string_utilities.valign_block =
function( Content )
189 return(
"<div class=\"valign_child\">" + Content +
"</div><div class=\"valign_helper\"></div>" );
203 ultimix.string_utilities.halign_block =
function( Content , Width )
206 "<div class=\"margin_0_auto\" style=\"display: block; width: " +
207 Width +
"px; height: 100%;\">" + Content +
"</div>"
222 ultimix.string_utilities.trim =
function( Str , Charlist )
224 Charlist = !Charlist ?
' \s\xA0' : Charlist.replace( /([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g ,
'\$1' );
226 var re =
new RegExp(
'^[' + Charlist +
']+|[' + Charlist +
']+$' ,
'g' );
228 return( Str.replace( re ,
'' ) );