Inserts the specified string into the source at the specified location

@param str
the string to insert
@param lineno
the line number to insert to
@param colno
the column number to insert to
168405
public void insert(String str, int lineno, int colno) {
		final String sourceMethod = "insert"; //$NON-NLS-1$
		if (isTraceLogging) {
			log.entering(JSSource.class.getName(), sourceMethod, new Object[]{str, lineno, colno});
		}
		PositionLocator locator = new PositionLocator(lineno, colno);
		locator.insert(str);
		if (isTraceLogging) {
			log.exiting(JSSource.class.getName(), sourceMethod, "String \"" + str + "\" inserted at " + mid + "(" + lineno + "," + colno + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
		}
	}
103225
public static void writeStringAsText(DataOutput stream, String str) throws IOException {
    byte[] utf8Encoded = str.getBytes(StandardCharsets.UTF_8);
    writeVLong(stream, utf8Encoded.length);
    stream.write(utf8Encoded);
  }
842793
function Insert (str, position) {
    if (!this || this.constructor !== SimpleTextOperation) {
      // => function was called without 'new'
      return new Insert(str, position);
    }
    this.str = str;
    this.position = position;
  }
638714
public static String insert(final String str, final String given, final int begin, final int end) {
    if (begin < 1 || end > str.length() || end < begin) { return str; }
    return str.substring(0, begin - 1) + given + str.substring(end);
  }
1091397
def _get_text_pos(self, charno, lineno):
        
        return self._get_char_x(charno), self._get_line_y(lineno)
612039
public void insertStringBefore(Node node, String str){
        boolean startingNode = this.node==node;
        int cp[] = StringUtil.toCodePoints(str);
        for(int i=cp.length-1; i>=0; i--){
            Node newNode = new Node();
            for(Edge edge: node.incoming()){
                if(!edge.loop())
                    edge.setTarget(newNode);
            }
            newNode.addEdgeTo(node).matcher = new Any(cp[i]);
            node = newNode;
        }
        if(startingNode)
            this.node = node;
    }
950696
public static function line( $str, $col = null, $erase = true ) {
		if( $col !== null ) {
			Cursor::rowcol($col, 1);
		}
		if( $erase ) {
			Erase::line();
		}
		fwrite(self::$stream, $str);
	}
6602
protected void writeRow(final String... columns) throws IOException {
		
		if( columns == null ) {
			throw new NullPointerException(String.format("columns to write should not be null on line %d", lineNumber));
		} else if( columns.length == 0 ) {
			throw new IllegalArgumentException(String.format("columns to write should not be empty on line %d",
				lineNumber));
		}
		
		StringBuilder builder = new StringBuilder();
		for( int i = 0; i < columns.length; i++ ) {
			
			columnNumber = i + 1; // column no used by CsvEncoder
			
			if( i > 0 ) {
				builder.append((char) preference.getDelimiterChar()); // delimiter
			}
			
			final String csvElement = columns[i];
			if( csvElement != null ) {
				final CsvContext context = new CsvContext(lineNumber, rowNumber, columnNumber);
				final String escapedCsv = encoder.encode(csvElement, context, preference);
				builder.append(escapedCsv);
				lineNumber = context.getLineNumber(); // line number can increment when encoding multi-line columns
			}
			
		}
		
		builder.append(preference.getEndOfLineSymbols()); // EOL
		writer.write(builder.toString());
	}
264096
private void writeCellValue(Object value, Map<String, Integer> schema, String column, Row row) {
        if (column == null || value == null) {
            return;
        }
        Cell cell = row.getCell(schema.get(column), Row.CREATE_NULL_AS_BLANK);
        if (NumberUtils.isNumber(value.toString())) {
            cell.setCellValue(Double.parseDouble(value.toString()));
        } else {
            if (value.toString().contains("\n")) {
                cell.getCellStyle().setWrapText(true);
            }
            cell.setCellValue(value.toString());
        }
    }
1051597
private static void insertToColumnList(
            List<ParsedColInfo> columnList, List<ParsedColInfo> newCols) {
        for (ParsedColInfo col : newCols) {
            if (!columnList.contains(col)) {
                columnList.add(col);
            }
        }
    }
1006847
public void parse( String line, File sourceFile, int lineNumber ) {

		// Reset
		this.rawNameToVariables.clear();
		this.errors.clear();
		this.cursor = 0;

		// Parse
		while( this.cursor < line.length()) {

			char c = line.charAt( this.cursor );
			if( Character.isWhitespace( c ) || c == ',' )
				this.cursor ++;

			recognizeVariable( line, sourceFile, lineNumber );
		}
	}
916891
public static Node getNodeByLineCol(Node ancestor, int lineNo, int columNo) {
    checkArgument(ancestor.isScript());
    Node current = ancestor;
    Node result = null;
    while (current != null) {
      int currLineNo = current.getLineno();
      checkState(current.getLineno() <= lineNo);
      Node nextSibling = current.getNext();
      if (nextSibling != null) {
        int nextSiblingLineNo = nextSibling.getLineno();
        int nextSiblingColumNo = getColumnNoBase1(nextSibling);
        if (result != null
            && lineNo == nextSiblingLineNo && columNo == nextSiblingColumNo) {
          // The cursor is in-between two nodes.
          // If just one of them is a variable, a property, or a literal, return that one.
          // Otherwise, return the node to the left of the cursor.
          if (result.hasChildren() && !nextSibling.hasChildren()) {
            return nextSibling;
          }
          return result;
        }
        // Check if the desired location is past the end of the current node,
        // and if so, continue to the siblings.
        if (lineNo > nextSiblingLineNo
            || (lineNo > currLineNo && lineNo == nextSiblingLineNo)
            || (lineNo == nextSiblingLineNo && columNo > nextSiblingColumNo)) {
          current = nextSibling;
          continue;
        }
      }
      // The desired node is either current or one of its children.
      int currColumNo = getColumnNoBase1(current);
      if (currLineNo == lineNo) {
        if (currColumNo > columNo) {
          // current starts past the desired node, return.
          return result;
        }
        if (currColumNo + current.getLength() >= columNo) {
          result = current;
        }
      }
      current = current.getFirstChild();
    }
    return result;
  }
909316
public void addText(String str)
	{
		if (selectingText)
			deleteSelectedText();

		final StringBuilder oldText = this.text;
		final String oldValue = this.text.toString();
		String newValue = oldText.insert(this.cursor.index, str).toString();

		if (this.filterFunction != null)
			newValue = this.filterFunction.apply(newValue);

		if (!fireEvent(new ComponentEvent.ValueChange<>(this, oldValue, newValue)))
			return;

		this.text = new StringBuilder(newValue);
		guiText.setText(newValue);

		cursor.jumpBy(str.length());
	}
1207745
public void addImport(String imprt, int lineNo) {
        imports.add(imprt);
        if (imprt.endsWith(".*")) {
            imprt = imprt.substring(0, imprt.lastIndexOf(".*"));
            templateClass.importPaths.add(imprt);
        }
        importLineMap.put(imprt, lineNo);
    }
323418
public static void insert (@Nonnull final CharSequence aSeq, final int nIndex, final int nCodepoint)
  {
    if (!(aSeq instanceof StringBuilder))
    {
      insert (new StringBuilder (aSeq), nIndex, nCodepoint);
    }
    else
    {
      int nI = nIndex;
      if (nI > 0 && nI < aSeq.length ())
      {
        final char ch = aSeq.charAt (nI);
        final boolean low = Character.isLowSurrogate (ch);
        if (low && Character.isHighSurrogate (aSeq.charAt (nI - 1)))
        {
          nI--;
        }
      }
      ((StringBuilder) aSeq).insert (nI, Character.toChars (nCodepoint));
    }
  }
580974
private void addLine(Content pre, String line, int currentLineNo) {
        if (line != null) {
            Content anchor = HtmlTree.A(configuration.htmlVersion,
                    "line." + Integer.toString(currentLineNo),
                    new StringContent(utils.replaceTabs(line)));
            pre.addContent(anchor);
            pre.addContent(NEW_LINE);
        }
    }
651182
public int insertOutput(byte[] str, int strP, int strLen, byte[] strEncoding) {
        byte[] insertEncoding = encodingToInsertOutput();
        byte[] insertBuf = null;

        started = true;

        if (strLen == 0) return 0;

        final byte[] insertStr;
        final int insertP;
        final int insertLen;
        if (caseInsensitiveEquals(insertEncoding, strEncoding)) {
            insertStr = str;
            insertP = 0;
            insertLen = strLen;
        } else {
            Ptr insertLenP = new Ptr();
            insertBuf = new byte[4096]; // FIXME: wasteful
            insertStr = allocateConvertedString(strEncoding, insertEncoding, str, strP, strLen, insertBuf, insertLenP);
            insertLen = insertLenP.p;
            insertP = insertStr == str ? strP : 0;
            if (insertStr == null) return -1;
        }

        int need = insertLen;

        final int lastTranscodingIndex = numTranscoders - 1;
        final Transcoding transcoding;

        Buffer buf;

        if (numTranscoders == 0) {
            transcoding = null;
            buf = inBuf;
        } else if (elements[lastTranscodingIndex].transcoding.transcoder.compatibility.isEncoder()) {
            transcoding = elements[lastTranscodingIndex].transcoding;
            need += transcoding.readAgainLength;
            if (need < insertLen) return -1;

            if (lastTranscodingIndex == 0) {
                buf = inBuf;
            } else {
                buf = elements[lastTranscodingIndex - 1];
            }
        } else {
            transcoding = elements[lastTranscodingIndex].transcoding;
            buf = elements[lastTranscodingIndex];
        }

        if (buf == null) {
            buf = new Buffer();
            buf.allocate(need);
        } else if (buf.bytes == null) {
            buf.allocate(need);
        } else if ((buf.bufEnd - buf.dataEnd) < need) {
            // try to compact buffer by moving data portion back to bufStart
            System.arraycopy(buf.bytes, buf.dataStart, buf.bytes, buf.bufStart, buf.dataEnd - buf.dataStart);
            buf.dataEnd = buf.bufStart + (buf.dataEnd - buf.dataStart);
            buf.dataStart = buf.bufStart;

            if ((buf.bufEnd - buf.dataEnd) < need) {
                // still not enough room; use a separate buffer
                int s = (buf.dataEnd - buf.bufStart) + need;
                if (s < need) return -1;
                Buffer buf2 = buf = new Buffer();
                buf2.allocate(s);
                System.arraycopy(buf.bytes, buf.bufStart, buf2.bytes, 0, s); // ??
                buf2.dataStart = 0;
                buf2.dataEnd = buf.dataEnd - buf.bufStart;
            }
        }

        System.arraycopy(insertStr, insertP, buf.bytes, buf.dataEnd, insertLen);
        buf.dataEnd += insertLen;
        if (transcoding != null && transcoding.transcoder.compatibility.isEncoder()) {
            System.arraycopy(transcoding.readBuf, transcoding.recognizedLength, buf.bytes, buf.dataEnd, transcoding.readAgainLength);
            buf.dataEnd += transcoding.readAgainLength;
            transcoding.readAgainLength = 0;
        }

        return 0;
    }