MCPcopy Create free account
hub / github.com/ActiveState/code / trim_str

Function trim_str

recipes/JavaScript/578517_Music_player/recipe-578517.js:107–131  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

105
106
107function trim_str(s)
108{
109 var i=0;
110 var r='';
111 var c='';
112 var b_start=false;
113 var end_index=0;
114 s=''+s;
115 for (i=s.length-1;i>0;i--)
116 {
117 c=s.charAt(i);
118 if(c!=' ')
119 {
120 end_index=i;
121 break;
122 }
123 }
124 for (i=0;i<=end_index;i++)
125 {
126 c=s.charAt(i);
127 if(c!=' ')b_start=true;
128 if(b_start==true)r=r+c;
129 }
130 return r;
131}
132
133function replaceAll(txt, s_replace, with_this)
134{

Callers 5

init_capsFunction · 0.85
replace_all_upperFunction · 0.85
fix_contractionsFunction · 0.85
do_searchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected