アプリ版:「スタンプのみでお礼する」機能のリリースについて

 FileMaker6で文字列を数字列に変更したいと考えています。
具体的には、文字列のフィールドに「たなか」と入力されているとします。これを、
あ行は1、か行は2、さ行は3・・・・
の原則にのっとり、計算フィールドの数字列に自動的に入力したいのです。「たなか」を数字に変更すると、「452」となります。
どのような関数式が、数字列の計算フィールドには必要でしょうか。

A 回答 (1件)

計算フィールドが2つ必要でした。



ひらがなが入力されている文字列のフィールド名を「テキスト」と仮定します。

まず、第一段階のフィールドとして、「前半」という、文字タイプの計算フィールドを造り、計算式は下記にします。

Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(テキスト,"あ","1"),"ぃ","1"),"い","1"),"ぅ","1"),"う","1"),"ぇ","1"),"え","1"),"ぉ","1"),"お","1"),"か","2"),"が","2"),"き","2"),"ぎ","2"),"く","2"),"ぐ","2"),"け","2"),"げ","2"),"こ","2"),"ご","2"),"さ","3"),"ざ","3"),"し","3"),"じ","3"),"す","3"),"ず","3"),"せ","3"),"ぜ","3"),"そ","3"),"ぞ","3"),"た","4"),"だ","4"),"ち","4"),"ぢ","4"),"っ","4"),"つ","4"),"づ","4"),"て","4"),"で","4"),"と","4"),"ど","4")

次に、「完成」という、文字タイプの計算フィールドを造り、計算式は下記にします。

Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(前半,"な","5"),"に","5"),"ぬ","5"),"ね","5"),"の","5"),"は","6"),"ば","6"),"ぱ","6"),"ひ","6"),"び","6"),"ぴ","6"),"ふ","6"),"ぶ","6"),"ぷ","6"),"へ","6"),"べ","6"),"ぺ","6"),"ほ","6"),"ぼ","6"),"ぽ","6"),"ま","7"),"み","7"),"む","7"),"め","7"),"も","7"),"ゃ","8"),"や","8"),"ゅ","8"),"ゆ","8"),"ょ","8"),"よ","8"),"ら","9"),"り","9"),"る","9"),"れ","9"),"ろ","9"),"ゎ","A"),"わ","A"),"ゐ","A"),"ゑ","A"),"を","A"),"ん","B")

こうすれば、完成 フィールドに、変換結果の数字が文字列として、表示されます。

式が長すぎて、1つの計算フィールドに入り切りませんでした。
また、「わ」行を「A」「ん」を「B」に変換しています。
10,11で有れば、「完成」の式を修正してください。
ひらがな以外は変換されません。
小さなひらがな、濁点半濁点も変換してあります。

この回答への補足

 お礼と補足が逆になってしまいました。
あれこれ書きましたが、3文字問題はCase関数で2文字の時のみ、"0"を加えることで解決しました。ありがとうございました。

補足日時:2004/02/15 17:47
    • good
    • 0
この回答へのお礼

 早速の回答ありがとうございます。
実は質問に少し付け加えさせてください。
数字列は必ず3文字にしたいのです。
従って「たなか」の場合は、必然的に数字列も
3列になりますが、「たけ」のような場合は
そのままの数字列「42」に「0」を加えて
「042」にしたいのです。
後からこのようなことを言うのは、申し訳ないのですが、お願いします。
文字列が3文字なら頂いた回答で、いけました。

お礼日時:2004/02/15 03:27

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!

関連するカテゴリからQ&Aを探す