vertx / io.vertx.core.cli / UsageMessageFormatter / findWrapPos

findWrapPos

open static fun findWrapPos(text: String, width: Int, startPos: Int): Int

Finds the next text wrap position after startPos for the text in text with the column width width. The wrap point is the last position before startPos+width having a whitespace character (space, \n, \r). If there is no whitespace character before startPos+width, it will return startPos+width.

Parameters

text - The text being searched for the wrap position

width - width of the wrapped text

startPos - position from which to start the lookup whitespace character

Return
position on which the text must be wrapped or -1 if the wrap position is at the end of the text