J
Josselin
I don't use it very often, rather copying from example, but it's so
useful that I should learn how to write it
I'd appreciate any guru tip on how to proceed once the problem is on
the paper :
example :
INPUT STRINGS
1- input can contains spaces (should be eliminated)
2- good patterns :
2a- an Integer like 99 (no limit)
2b- a String like: abcd abc99 99abc a99bc
2c- a % sign followed by a String
like %abcd %abc99 %99abc %a99bc %abcd
2d- a String followed by a % sign
like abcd% abc99% 99abc% a99bc%
2e- a String leading containing or ending with, one or many * sign(s)
like a*bcd a**bc99 99*a*bc *a99bc a99bc* *a99bc* *a9**9b*c*
3-any other pattern will be considered as wrong
OUTPUTS
2a -> an array [characters, Integer] like [ "<>", 99]
2b, 2c, 2d,2e -> an array [ nil, String] like [nil, abcd] or [nil,
%abcd] or [nil, a99bc%] or [nil, *a9**9b*c]
I am interesting in understanding the design process... : how should I
start when designing such gsub routine ?
should I state it differently on paper first ? well, any tip that can
help me to build the next ones....
thanks for your support
joss
useful that I should learn how to write it
I'd appreciate any guru tip on how to proceed once the problem is on
the paper :
example :
INPUT STRINGS
1- input can contains spaces (should be eliminated)
2- good patterns :
2a- an Integer like 99 (no limit)
a > >= said:=99 <99 <=99 <>99 !=99
2b- a String like: abcd abc99 99abc a99bc
2c- a % sign followed by a String
like %abcd %abc99 %99abc %a99bc %abcd
2d- a String followed by a % sign
like abcd% abc99% 99abc% a99bc%
2e- a String leading containing or ending with, one or many * sign(s)
like a*bcd a**bc99 99*a*bc *a99bc a99bc* *a99bc* *a9**9b*c*
3-any other pattern will be considered as wrong
OUTPUTS
2a -> an array [characters, Integer] like [ "<>", 99]
2b, 2c, 2d,2e -> an array [ nil, String] like [nil, abcd] or [nil,
%abcd] or [nil, a99bc%] or [nil, *a9**9b*c]
I am interesting in understanding the design process... : how should I
start when designing such gsub routine ?
should I state it differently on paper first ? well, any tip that can
help me to build the next ones....
thanks for your support
joss