From 5d7ce2843bbd858b3114df9a92c55fc3d42eb67c Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sat, 9 Nov 2002 21:31:59 +0000 Subject: *** empty log message *** --- perl_checker.src/common.ml | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'perl_checker.src/common.ml') diff --git a/perl_checker.src/common.ml b/perl_checker.src/common.ml index 4b33f8f..0f20e7a 100644 --- a/perl_checker.src/common.ml +++ b/perl_checker.src/common.ml @@ -653,6 +653,18 @@ let skip_n_char_ beg end_ s = String.sub s beg (String.length s - beg - end_) let skip_n_char n s = skip_n_char_ n 0 s +let rec index_spaces_from beg s = + if s.[beg] = ' ' || s.[beg] = '\t' then beg else index_spaces_from (beg+1) s +let index_spaces s = index_spaces_from 0 s + +let rec index_non_spaces_from beg s = + if s.[beg] = ' ' || s.[beg] = '\t' then index_non_spaces_from (beg+1) s else beg +let index_non_spaces s = index_non_spaces_from 0 s + +let rec rindex_non_spaces_from beg s = + if s.[beg] = ' ' || s.[beg] = '\t' then rindex_non_spaces_from (beg-1) s else beg +let rindex_non_spaces s = rindex_non_spaces_from (String.length s - 1) s + let rec explode_string = function | "" -> [] | s -> (String.get s 0) :: explode_string (String.sub s 1 (String.length s - 1)) -- cgit v1.2.1