function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
haruca.kharuca.k 

Apexでカタカナ入力チェック

お世話になっております。

 

Apexで、カタカナの入力チェック等を行うことは可能でしょうか。

 

Javaだと下のサイトのように、matchesメソッドを使って実装できるようですが、

http://d.hatena.ne.jp/dirablue/20090506/1241607961

同じようなことをApexで実装できるのでしょうか?

私が試した限りでは、Apexではmatchesメソッド使えないようでした。

Best Answer chosen by Admin (Salesforce Developers) 
Taiki YoshikawaTaiki Yoshikawa

すごく参考になりそうなサイトがありました。

 

正規表現)文字列が全角カタカナ(30A1-30F6)のみか判定したい

http://pgf2-dev.tumblr.com/post/43465272239/force-com-apex

 

 

Pattern Methods の中にmatchesがあるみたいです。

 

 

Pattern Methods

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_classes_pattern_and_matcher_pattern_methods.htm?SearchType=Stem

 

 

あとは登録用の項目があるのでしたら、入力規則で判定させたりもできると思います。

入力規則のエラーはDML Exceptionで拾うことができます。

All Answers

Taiki YoshikawaTaiki Yoshikawa

すごく参考になりそうなサイトがありました。

 

正規表現)文字列が全角カタカナ(30A1-30F6)のみか判定したい

http://pgf2-dev.tumblr.com/post/43465272239/force-com-apex

 

 

Pattern Methods の中にmatchesがあるみたいです。

 

 

Pattern Methods

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_classes_pattern_and_matcher_pattern_methods.htm?SearchType=Stem

 

 

あとは登録用の項目があるのでしたら、入力規則で判定させたりもできると思います。

入力規則のエラーはDML Exceptionで拾うことができます。

This was selected as the best answer
haruca.kharuca.k

迅速なご回答、ありがとうございます。

 

実装したいことができました!!

ありがとうございました!!