我有一个类似的字符串"75003 Paris, France"或"Syracuse, NY 13205, USA".
我想使用相同的代码从这些字符串中删除所有这些数字.
我怎样才能做到这一点?
我的应用程序中有几个控制器.当我的应用程序在一个控制器中调用一个函数时,我想更新其他控制器的UI.我怎样才能做到这一点?
class FirstViewController: UIViewController {
func updateUI {...}
}
class SecondViewController: UIViewController {
func updateUI {...}
}
class ThirdViewController: UIViewController{
func updateAllUI {...} # I want call FirstViewController().updateUI() and SecondViewController().updateUI() here
}
Run Code Online (Sandbox Code Playgroud)
但是FirstViewController()意味着我创建了一个我不想要的新FirstViewController,并且已经创建了FirstViewController.那么如何在updateAllUI()中调用所有其他控制器的updateUI()
请帮帮忙,谢谢!
我搜索了所有解决方案并应用到我的项目中.但他们没有工作.我已将此权限拒绝.我已将所有可能的权限放入清单文件中.请告诉我我的项目有什么问题.
public static void getGetResponse() {
InputStream inputStream = null;
try {
URL url = new URL("http://120.26.89.113:8080/common/qiniuToken");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
String userPassword = "wehelper:***********";
byte[] encodedBytes = Base64.encode(userPassword.getBytes(), 0);
connection.setRequestProperty("Authorization", "Basic " + encodedBytes);
connection.connect();
int resCode = connection.getResponseCode();
if (resCode == 200) {
inputStream = connection.getInputStream();
}
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder out = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
out.append(line);
}
System.out.println(out.toString());//Prints the string content read from input stream …Run Code Online (Sandbox Code Playgroud)