Tags » Substring

Bonfire 09: Confirm the Ending

TASK: Check if a string (first argument) ends with the given target string (second argument).


var index = str.length-target.length;

if (str.substr(index)===target) {
return true;
}

else return false;
}

Bonfire

How to Format a Date in Command Prompt (CMD) to YYYYMMDD

For those that don’t like reading tutorials, and prefer watching how it is done whilst following along, I have attached my YouTube video of the same tutorial. 324 more words

Cmd

Mysql Substring approches

SUBSTR and SUBSTRING are synonyms, therefore can be used interchangeably.
Indexing starts with 1 (not 0)
(The result of each query is in the comment starting with #) 24 more words

String

Suffix Array: Longest(All) Repeated Substring

Compare Function According to Length:

#include <set>

using namespace std;


struct stringcomp {
  bool operator() (const string& lhs, const string& rhs) const
  {return lhs.length()>=rhs.length();}
};
… 427 more words
Helpful API

Java substring (basics)

    public static void main(String[] args) {

        //substring(beginIndex)
        //substring(beginIndexIncluding,endIndexExcluding);

        String s = "0123456789";
        System.out.println("'" + s.substring(0) + "'");
        System.out.println("'" + s.substring(1) + "'");
        System.out.println("'" + s.substring(10) + "'");
        System.out.println("'" + s.substring(0, 0) + "'");
        System.out.println("'" + s.substring(0, 1) + "'");
        System.out.println("'" + s.substring(0, 10) + "'");
    }

Output:
'0123456789'
'123456789'
''
''
'0'
'0123456789'

Java

132 Palindrome Partitioning II

Given a string s, partition s such that every substring of the partition is a palindrome.

Return the minimum cuts needed for a palindrome partitioning of s. 17 more words

Leetcode

131 Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.

Return all possible palindrome partitioning of s.

For example, given s = … 7 more words

Leetcode