title: How can I split a string into substrings?
body: <p>I want to split the string <code>"KD-435"</code> into two substrings to check whether the first substring <code>"KD-"</code> begins with the following characters <code>"KD-"</code> and the second substring is number beteewn <code>"400-500"</code>. </p>
  
  <p>I have the following method and I want to change it to do that at this position <code>if (ssid.startsWith("KD-"))</code></p>
  
  <pre><code>private void check_wifi_available() {
      WifiManager wifiManager = (WifiManager) this
              .getSystemService(this.WIFI_SERVICE);
  
      final List&lt;ScanResult&gt; results = wifiManager.getScanResults();
      if (results != null) {
  
          List&lt;ScanResult&gt; updatedResults = new ArrayList&lt;ScanResult&gt;();
          // pick wifi access ponits which begins with these "KD" characters.
          for (int i = 0; i &lt; results.size(); i++) {
              String ssid = results.get(i).SSID;
              if (ssid.startsWith("KD")) {
  
                  updatedResults.add(results.get(i));
              }
          }
          if (updatedResults.size() &gt; 0) {
              String a = calculateBestAccessPoint(updatedResults);
              textWifi.setText(a.toString());
          }
      }
  }
  </code></pre>