Git Product home page Git Product logo

manmaru.stringutil's Introduction

MANMARU STRINGUTIL JS

Inspired from CASA Lib / AS 2.0 (v.10/06/08) - Aaron Clinger, David Nelson

manmaru.stringutil.js :
Javascript utilities for manipulating and searching strings.

functions list :
addAt(source, position, addition) ->
Adds characters at a specific index
@param source: String to add characters to
@param position: Position in which to add characters
@param addition: String to add
@return String with characters added

contains(source, search) ->
Determines if string contains search string
@param source: String to search in
@param search: String to search for
@return Returns the frequency of the search term found in source string

getNumbersFromString(source) ->
Removes all non numeric characters from string
@param source: String to return numbers from
@return String containing only numbers

getUniqueCharacters(source) ->
Extracts all the unique characters from a source String
@param source: String to find unique characters within
@return String containing unique characters from source String

remove(source, remove) ->
Removes characters from a source string
@param source: String to remove characters from
@param remove: String describing characters to remove
@return String with characters removed

removeAt(source, position) ->
Removes a character at a specific index
@param source: String to remove character from
@param position: Position of character to remove
@return String with character removed

removeNumbersFromString(source) ->
Removes all numeric characters from string
@param source: String to remove numbers from
@return String with numbers removed

removeWhitespace(source) ->
Removes tabs, linefeeds, carriage returns and spaces from string
@param source: String to remove whitespace from
@return String with whitespace removed

replace(source, remove, replace) ->
Replaces target characters with new characters
@param source: String to replace characters from
@param remove: String describing characters to remove
@param replace: String to replace removed characters
@return String with characters replaced

replaceAt(source, position, replace) ->
Replaces a character at a specific index with new characters
@param source: String to replace characters from
@param position: Position of character to replace
@param replace: String to replace removed character
@return String with character replaced

toTitleCase(source) ->
Transforms source string to per word capitalization.
@param source: String to return as title cased.
@return String with capitalized words.

urlValue(name, string) ->
Get value of string with URLFormat
@param name Example: &var1=mi_var1&var2=mi_var2&var3=mi_var3
StringUtil.urlValue('var2')
@return String mi_var2

urlFriendly(source, max) ->
Transform source string in url string format
@param source: String to return as url format
@return string

pathVars(str, number_return) ->
Transform source url string in array
@param source: url string to return in array
@return array

utf8Encode(source) ->
UTF8 Encode
@param source: string to encode
@return encoded UTF8 String

utf8Decode(source) ->
UTF8 Decode
@param source: string to Decode
@return Decode UTF8 String

lnToBr(source) ->
Transform \n to br
@param source: String
@return String

brToLn(source) ->
Transform br to \n
@param source: String
@return String


How to use:
StringUtil.functionName("param");

Example of use :
var testString = "Lorem ipsum dolor sit amet, consectetur adipiscing elit";
console.log(StringUtil.removeWhitespace(testString));
return -> Loremipsumdolorsitamet,consecteturadipiscingelit

manmaru.stringutil's People

Contributors

adrien-dufond avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.