1
대량 sms API를 사용하여 트리거하는 데 사용하고 있으며 휴대 전화 번호와 Android 전화로 SMS를 보냅니다. 대량 SMS API의 형식은다음 형식의 HTTP 응답을 구문 분석하는 방법
http://xxx.xxx.xxx/bulksms/bulksms?username=fds-xxx&password=xxx&type=0&dlr=1&destination=9422522891,8275004333&source=xxx&message=18%20December
를 다음과 다음은 내가
bytesSent = httpclient.execute(httppost, res);
응답 내가 구문 분석하려면 어떻게
1701|919422522891:224c1214-bb95-414d-ba76-77db95370545,1701|918275004333:5e93a439-2644-4455-9f01-f27e6cf0cde6
아래 코드를 사용하여 문자열로 안드로이드에서 얻을 수있는 반응이다 키 값 쌍과 같은 응답?
다음 코드를 사용하면 약간의 성공을 거둘 수 있지만 regex char가 '|'일 때 실패합니다.
public String[] split(String regex,String input)
{
input = "1701|919422522891:224c1214-bb95-414d-ba76-77db95370545,1701|918275004333:5e93a439-2644-4455-9f01-f27e6cf0cde6";
regex = "|"; // does not work
//regex = ":"; // works correct
String[] soso = Pattern.compile(regex).split(input, input.length());
for (String s : soso) {
Log.e("TAG",s.toString());
}
return null;
}
for regex char '|'
내가 좋아하는 단일 문자 문자열 배열로 로그 출력 { "1", "7", "0", ........}
UPDATE를 얻을
regex = "\\|" // works fine
regex char가 '|'일 때 split 함수가 잘못된 출력을줍니다. 하지만 정규식 char 때 ":" –
업데이트 된 코드에 대한 질문을 확인 작동합니다 –