問題タブ [nscharacterset]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
swift - UITextFieldDelegate の shouldChangeCharactersIn メソッド - 小数点記号と文字の両方をチェックする条件文を組み合わせられない理由
私のreplacementTextHasLetter定数が、以下の条件付きで文字をテキストフィールドに貼り付けることを妨げないのはなぜですか?
しかし、独自の個別の条件がある場合、それは機能しますか?
編集:私はそれを理解しました。existingTextHasDecimalSeparatorとreplacementTextHasDecimalSeparatorは基本的に、テキストフィールドに小数があるかどうか、ユーザーが新しい小数を入力しようとしているかどうかを判断して false を返すため、最初の例が機能することは不可能です。追加すると
条件付きでは、すべてのステートメントが同時に真になることはできないため、実際には目的を果たしていません。ありがとう@sonofabeach
swift3 - NSTextField が 10 進数 (#.#) の数字とピリオドのみを受け入れるように強制する
Mac アプリのやNSTextField
のような数字とピリオドのみを受け入れるようにしようとしています。12.4
3.6
他のSOの質問を確認した後、かなり近づいているように感じますが、完全には理解できません。以下のコードは、文字を許可しないことを除いて機能します.
。a を入力してもビープ音は鳴りtrue
ません.
が、フィールドに文字が表示されません。
私が間違っていることは何か分かりますか?
swift - CharacterSet isSuperset 使用時のクラッシュ (EXC_BAD_ACCESS)
を使用して、入力文字列が有効な電話番号かどうかを判断しようとしていますCharacterSet
。正常にisSubset
動作しているようですが、isSuperset
クラッシュします。
これは Foundation のバグだと思います。
ios - Retrieve only positive integers from a given string
I have the following implementation where a comboKey
is a string that I am trying to retrieve the integers.
For example if the comboKey
is 2m1s
and then it returns @[@"2",@"1"]
; which is perfect.
If comboKey
is 0m2s
and then it returns @[@"0",@"2"];
, however I do not want to have 0
. I only want have positive number(s) @[@"2"];