Here you can find the source of SplitSearchTerms(String strSearch)
public static List<String> SplitSearchTerms(String strSearch)
//package com.java2s; /*//from ww w. j a v a2s. c o m KeePass Password Safe - The Open-Source Password Manager Copyright (C) 2003-2014 Dominik Reichl <dominik.reichl@t-online.de> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ import java.util.*; public class Main { public static List<String> SplitSearchTerms(String strSearch) { List<String> l = new ArrayList<String>(); if (strSearch == null) { assert false; return l; } StringBuilder sbTerm = new StringBuilder(); boolean bQuoted = false; for (int i = 0; i < strSearch.length(); ++i) { char ch = strSearch.charAt(i); if (((ch == ' ') || (ch == '\t') || (ch == '\r') || (ch == '\n')) && !bQuoted) { if (sbTerm.length() > 0) l.add(sbTerm.toString()); sbTerm.delete(0, sbTerm.length()); } else if (ch == '\"') bQuoted = !bQuoted; else sbTerm.append(ch); } if (sbTerm.length() > 0) l.add(sbTerm.toString()); return l; } }