What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-06 21:00:04
javascript check if string contains at the begins with substring
var str = "We got a poop cleanup on isle 4."; if(str.indexOf("poop") !== -1){ alert("Not again"); } //use indexOf (it returns position of substring or -1 if not found) Add solution -
-
Javascript 2022-03-06 00:30:47
convert rgb value in hexadecimal system
function convertRgb(rgb) { // This will choose the correct separator, if there is a "," in your value it will use a comma, otherwise, a separator will not be used. var separator = rgb.indexOf(",") > -1 ? "," : &quo... Add solution -
TypeScript 2022-03-06 00:05:30
typescript static class equivalent
//Example of Typescript static class equivalent export abstract class Tools { public static truncate(str, length) { var ending = '...'; if (str.length > length) { return str.substring(0, length - ending.length) + ending; } el... Add solution -
Python 2022-03-05 19:00:29
Python Program to Count the Occurrences of a Word in a Text File
#get file object reference to the file file = open("C:\workspace\python\data.txt", "r") #read content of file to string data = file.read() #get number of occurrences of the substring in the string occurrences = data.count("python&... Add solution -
Other 2022-03-05 09:10:30
<mvc:resources mapping="/resources/**" location="/WEB-INF/resources/" />
<mvc:resources location="/resources/" mapping="/resource/**"/> The location attribute of the tag defines the base directory location of static resources that you want to serve. It can be images path that are available under the ... Add solution -
Other 2022-03-03 05:45:31
signaure pad convert to img
const dataURL = this.signaturePad.toDataURL('image/png'); const data = atob(dataURL.substring('data:image/png;base64,'.length)), asArray = new Uint8Array(data.length); for (var i = 0, len = data.length; i < len; ++i) { asArray[i] = data.charCodeAt... Add solution