Skip to content

Consolidate some text handling functions - #562

Merged
Pete Gonzalez (octogonz) merged 4 commits into
masterfrom
pgonzal/text-lib
Mar 14, 2018
Merged

Pete Gonzalez (octogonz) merged 4 commits into
masterfrom
pgonzal/text-lib

Conversation

@octogonz

Copy link
Copy Markdown
Collaborator

This PR introduces three new API functions:

  • Text.replaceAll()
  • Text.convertToCrLf()
  • Text.convertToLf()

This deduplicates a bunch of expressions and utility functions scattered throughout our code.

* @param replaceValue - The replacement text
*/
public static replaceAll(input: string, searchValue: string, replaceValue: string): string {
return input.split(searchValue).join(replaceValue);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input.split(searchValue).join(replaceValue); [](start = 11, length = 44)

That's clever.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@octogonz
Pete Gonzalez (octogonz) merged commit c47e97e into master Mar 14, 2018
@octogonz
Pete Gonzalez (octogonz) deleted the pgonzal/text-lib branch May 2, 2018 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants