Java String Extract extractStreetName(String address)

Here you can find the source of extractStreetName(String address)

Description

extract Street Name

License

Apache License

Declaration

public static String extractStreetName(String address) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Arrays;

public class Main {
    public static String extractStreetName(String address) {

        String[] parts = address.split("\\s");

        for (int i = parts.length - 1; i >= 0; i--) {
            String part = parts[i];

            if (part.length() > 3 && !part.contains("/")
                    && !part.matches(".*\\d.*")) {
                return String
                        .join(" ", Arrays.copyOfRange(parts, 0, i + 1));
            }//w w  w  .  j  a v  a2  s  .co m
        }
        return "";
    }
}

Related

  1. extractNumbers(String text)
  2. extractPacket(String serverPacket)
  3. extractParameters(String uri)
  4. extractParamsFromUriTemplateFragment(String value)
  5. extractReferences(String value)
  6. extractStrings(String s)
  7. extractStringsAroundDots(String s)
  8. extractTableName(String line)
  9. extractTags(Map layoutProperties)