Here you can find the source of insertStringAtOffset(String srcStr, String inStr, int offset)
public static String insertStringAtOffset(String srcStr, String inStr, int offset)
//package com.java2s; /*/*w w w .j ava 2 s.c o m*/ * @(#)TextUtility.java * * Copyright (c) 2003 DCIVision Ltd * All rights reserved. * * This software is the confidential and proprietary information of DCIVision * Ltd ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the license * agreement you entered into with DCIVision Ltd. */ public class Main { public static String insertStringAtOffset(String srcStr, String inStr, int offset) { String result = ""; if (inStr == null) { inStr = "\n"; } for (int i = 0; i < srcStr.length(); i++) { if (i != 0 && i % offset == 0) { result += inStr; } result += srcStr.charAt(i); } return (result); } }