What do you want to save?
Add Code snippet
New code examples
-
Java 2021-10-17 07:47:06
Given a string and a non-empty substring sub, compute recursively the number of times that sub appears in the string, without the sub strings overlapping.
public int strCount(String str, String sub) { int strlen = str.length(); int sublen = sub.length(); if (strlen < sublen) return 0; if (str.substring(0,sublen).equals(sub)) return 1 + strCount(str.substring(sublen), sub); else r... Add solution -
C++ 2021-10-13 06:30:05
strlen in c++
#include <cstring> #include <cstring> using namespace std; int main(void) { char stringName[] = "This contains the content of your string"; int stringLength = strlen(stringName); cout << "String: " << st... Add solution -
PHP 2021-10-12 18:04:09
string between two strings
// Gegasoft found this useful and use in helper class function get_string_between($string, $start, $end){ $string = ' ' . $string; $ini = strpos($string, $start); if ($ini == 0) return ''; $ini += strlen($start); $len = strpos($string... Add solution -
Other 2021-10-10 02:09:05
validate id number
# NB--> Language: Perl # NB--> Country of ID: South Africa (RSA) use Scalar::Util 'looks_like_number'; sub Validate_IdNum($); sub GetLuhnDigit($); #----------------------------------------------------------------# # Validates the id number being pa... Add solution -
Other 2021-10-07 18:54:08
ilah has a string, , of lowercase English letters that she repeated infinitely many times. Given an integer, ,
function repeatedString($s, $n) { // check the number of occurrences of letter 'a' on given string $s $a_occurrences_in_s = substr_count($s, 'a'); // check how many occurrences of string $s belongs to an repeated string $s of length of $n... Add solution -
Other 2021-10-06 19:12:06
detect active virtual desktop autohotkey
RegRead, cur, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SessionInfo\1\VirtualDesktops, CurrentVirtualDesktop RegRead, all, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VirtualDesktops, VirtualDesktopIDs i... Add solution