1 /* 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 */ 21 22 namespace Lucene.Net.Support 23 { 24 public class TextSupport 25 { 26 /// <summary> 27 /// Copies an array of chars obtained from a String into a specified array of chars 28 /// </summary> 29 /// <param name="sourceString">The String to get the chars from</param> 30 /// <param name="sourceStart">Position of the String to start getting the chars</param> 31 /// <param name="sourceEnd">Position of the String to end getting the chars</param> 32 /// <param name="destinationArray">Array to return the chars</param> 33 /// <param name="destinationStart">Position of the destination array of chars to start storing the chars</param> 34 /// <returns>An array of chars</returns> GetCharsFromString(string sourceString, int sourceStart, int sourceEnd, char[] destinationArray, int destinationStart)35 public static void GetCharsFromString(string sourceString, int sourceStart, int sourceEnd, char[] destinationArray, int destinationStart) 36 { 37 int sourceCounter; 38 int destinationCounter; 39 sourceCounter = sourceStart; 40 destinationCounter = destinationStart; 41 while (sourceCounter < sourceEnd) 42 { 43 destinationArray[destinationCounter] = (char)sourceString[sourceCounter]; 44 sourceCounter++; 45 destinationCounter++; 46 } 47 } 48 } 49 } 50