Вызов конечной точки отдыха с помощью RestTemplate и класса данных Kotlin

Чтобы проверить IP-адрес при вводе, вы можете использовать это вместо:

private static final Pattern PARTIAl_IP_ADDRESS =
          Pattern.compile("^((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])\\.){0,3}"+
                           "((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])){0,1}$"); 

ipEditText.addTextChangedListener(new TextWatcher() {                       
    @Override public void onTextChanged(CharSequence s, int start, int before, int count) {}            
    @Override public void beforeTextChanged(CharSequence s,int start,int count,int after) {}            

    private String mPreviousText = "";          
    @Override
    public void afterTextChanged(Editable s) {          
        if(PARTIAl_IP_ADDRESS.matcher(s).matches()) {
            mPreviousText = s.toString();
        } else {
            s.replace(0, s.length(), mPreviousText);
        }
    }
});
0
задан IEE1394 18 March 2019 в 19:02
поделиться