This version of the Help is no longer updated. See JMP.com/help for the latest version.

.
Publication date: 07/30/2020

Munger

Munger works many different ways, depending on what you specify for its arguments:

Munger(string, offset, find | length, <replace>);

Table 6.7 Munger behaviors for various types of arguments

Find, length, and replace arguments

Example

If you specify a string as the find and specify no replace string, Munger returns the position (after offset) of the first occurrence find string.

Munger( "the quick brown fox", 1, "quick" );

5

If you specify a positive integer as the length and specify no replace string, Munger returns the characters from offset to offset + length.

Munger( "the quick brown fox", 1, 5 );

"the q"

If you specify a string as the find and specify a replace string, Munger replaces the first occurrence after offset of text with replace.

Munger( "the quick brown fox", 1, "quick", "fast" );

"the fast brown fox"

If you specify a positive integer as the length and specify a replace string, Munger replaces the characters from offset to offset + length with replace.

Munger( "the quick brown fox", 1, 5, "fast");

"fastuick brown fox"

If you specify a positive integer as the length, and offset + length exceeds the length of text, Munger either returns text from offset to the end or replaces that portion of text with the replace string, if it exists.

Munger( "the quick brown fox", 5, 25);

"quick brown fox"

Munger( "the quick brown fox", 5, 25, "fast" );

"the fast"

If you specify zero as the length and specify no replace string, Munger returns a blank string.

Munger( "the quick brown fox", 1, 0 );

""

If you specify zero as the length and specify a replace string, the string is inserted before the offset position.

Munger( "the quick brown fox", 1, 0, "see " );

"see the quick brown fox"

If you specify a negative integer as the length value and specify no replace string, Munger returns all characters from the offset to the end of the string.

Munger( "the quick brown fox", 5, -5 );

"quick brown fox"

If you specify a negative integer for length and specify a replace string, Munger replaces all characters from the offset to the end with the replace string.

Munger( "the quick brown fox", 5, -5, "fast" );

"the fast"

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).