Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
AS3では、文字列が2文字だけで構成されているかどうかを簡単に理解する方法はありますか?たとえば、2進数。調べている文字列が0と1だけで構成されているかどうかはわかりますか?
次のようなものがトリックを行う必要があります:
private function isBinary(str:String):Boolean { var binary:Boolean = true; for (var i:int = 0; i < str.length; i++) { if (str.charAt(i) != "0" && str.charAt(i) != "1") { binary = false; break; } } return binary; }