Skip to content

Instantly share code, notes, and snippets.

View Meraj's full-sized avatar
🖥️
coding, as usual

Meraj

🖥️
coding, as usual
View GitHub Profile
@Meraj
Meraj / removeDuplicates.cpp
Created February 9, 2021 18:30
remove all Duplicate letters in a string text
/**
* remove Duplicate letters in a text
* @param textString
* @return
*/
string removeDuplicates(std::string textString) {
if (textString.begin() == textString.end()) return textString;
auto no_duplicates = textString.begin();
for (auto current = no_duplicates; current != textString.end();) {
current = std::find_if(std::next(current), textString.end(), [no_duplicates](const char c) { return c != *no_duplicates; });
@Meraj
Meraj / replaceAll.cpp
Last active February 9, 2021 18:29
search in a string and replace all selected texts in c++
/**
* replace text in string
* @param str string
* @param from string
* @param to string
*/
string replaceAll(std::string str,std::string from, std::string to) {
if(from.empty())
return str;
size_t start_pos = 0;
@Meraj
Meraj / convertCursorToArray.kt
Last active December 27, 2020 11:27
a simple function that auto convert cursors to array in kotlin - android
/**
* a simple function that convert cursors to String Array
* ArioSql = https://github.com/MerajV/ArioSql
* @property cursor Cursor
* @return Array<Array<String>>
* @author MerajV
* @since 0.3.12
*/
fun convertCursorToArray(cursor: Cursor): Array<Array<String>> {
val getColumnsCount :Int = cursor.columnCount