匿名 #4218(2007/11/19 04:58 GMT) [ HSP ] Rating1/1=1.00
ジュースを複数のグラスに注ぎ分ける時と同じような考え方です。 投稿間際に確認したところ、ところてん さんと同じ手法のようですね。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
// 入力される値が2byte文字のみと仮定 #module #deffunc divid str _target, int num if (num <= 0) : return target = _target dim result, num count = 0 repeat strlen(target) >> 1 result(count) += 2 count++ if(count == num) : count = 0 loop count = 0 repeat num mes strmid(target, count, result(cnt)) count += result(cnt) loop return #global sample = "ゆめよりもはかなき世のなかをなげきわびつゝあかしくらすほどに四月十よひにもなりぬれば木のしたくらがりもてゆく" divid sample, 4 divid sample, 5 divid sample, 6
Rating1/1=1.00-0+
[ reply ]
匿名
#4218()
[
HSP
]
Rating1/1=1.00
// 入力される値が2byte文字のみと仮定 #module #deffunc divid str _target, int num if (num <= 0) : return target = _target dim result, num count = 0 repeat strlen(target) >> 1 result(count) += 2 count++ if(count == num) : count = 0 loop count = 0 repeat num mes strmid(target, count, result(cnt)) count += result(cnt) loop return #global sample = "ゆめよりもはかなき世のなかをなげきわびつゝあかしくらすほどに四月十よひにもなりぬれば木のしたくらがりもてゆく" divid sample, 4 divid sample, 5 divid sample, 6Rating1/1=1.00-0+
[ reply ]