File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -239,6 +239,30 @@ end function
239239
240240
241241
242+ ' ----------------------------------------------------------------
243+ ' function ltrim(ByVal s$, rep$)
244+ '
245+ ' Returns a copy of b$, removing all occurrences of rep$ on the
246+ ' left side (beginning) of s$. For example:
247+ '
248+ ' ----------------------------------------------------------------
249+ function ltrim( ByVal s$, ByVal rep$) as String
250+ DIM i as Uinteger = 0
251+ DIM d, l2 as Uinteger
252+ DIM l as Uinteger = len(rep$)
253+
254+ if not l then return s$
255+
256+ d = l - 1
257+ l2 = len(s$)
258+
259+ while i < l2 and rep = s(i to i + d)
260+ i = i + l
261+ end while
262+
263+ return s$(i to )
264+ end function
265+
242266
243267#undef __MAX_LEN__
244268
Original file line number Diff line number Diff line change @@ -239,6 +239,30 @@ end function
239239
240240
241241
242+ ' ----------------------------------------------------------------
243+ ' function ltrim(ByVal s$, rep$)
244+ '
245+ ' Returns a copy of b$, removing all occurrences of rep$ on the
246+ ' left side (beginning) of s$. For example:
247+ ' ltrim(": Hello world", ": ") returns "Hello World"
248+ ' ----------------------------------------------------------------
249+ function ltrim( ByVal s$, ByVal rep$) as String
250+ DIM i as Uinteger = 0
251+ DIM d, l2 as Uinteger
252+ DIM l as Uinteger = len(rep$)
253+
254+ if not l then return s$
255+
256+ d = l - 1
257+ l2 = len(s$)
258+
259+ while i < l2 and rep = s(i to i + d)
260+ i = i + l
261+ end while
262+
263+ return s$(i to )
264+ end function
265+
242266
243267#undef __MAX_LEN__
244268
You can’t perform that action at this time.
0 commit comments