Java String Extract extractUmiPositions(String pattern)

Here you can find the source of extractUmiPositions(String pattern)

Description

extract Umi Positions

License

Apache License

Declaration

public static List<Integer> extractUmiPositions(String pattern) 

Method Source Code


//package com.java2s;
/*//from   w w w . ja  va 2 s  .  c  o m
 * Copyright 2015 Mikhail Shugay (mikhail.shugay@gmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static final char UMI_BASE = 'N';

    public static List<Integer> extractUmiPositions(String pattern) {
        List<Integer> umiPositions = new ArrayList<>();

        for (int i = 0; i < pattern.length(); i++) {
            if (pattern.charAt(i) == UMI_BASE) {
                umiPositions.add(i);
            }
        }

        return umiPositions;
    }
}

Related

  1. extractStreetName(String address)
  2. extractStrings(String s)
  3. extractStringsAroundDots(String s)
  4. extractTableName(String line)
  5. extractTags(Map layoutProperties)
  6. extractWords(String s)