# This file is part of NIT ( http://www.nitlanguage.org ). # # Copyright 2004-2008 Jean Privat # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. var n = 7 if not args.is_empty then n = args.first.to_i end var s = "*" var i = 0 while i < n do var s2 = new Buffer.from("Je dis «") s2.append(s) s2.append("» et redis «") s2.append(s) s2.append("» et deux fois de plus : «") s2.append(s) s2.append(s) s2.append("».\n") s = s2.to_s i = i + 1 end print("Je dis «Je dis".search_all_in(s).length) i = 0 var j = 0 while j >= 0 do j = "Je dis «Je dis".search_index_in(s, j) if j >= 0 then i = i + 1 j = j + 1 end end print(i) i = 0 for k in [0..s.length[ do var c = s[k] if c >= 'a' and c <= 'z' then i = i + 1 end end print(i)