7 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for TrustyTony

Sometimes we want to not split by every space character, but we want to split only on those outside of brackets and quotes. This way we can have for example quoted string as single argument for command. EDIT: 1. Added hierarchical nesting of same kind of brackets. 2. Bunching multiple …

Member Avatar for gamesbook
1
3K
Member Avatar for vegaseat

Another little adventure into Go coding. This time a slice (a Go open ended array) of structures is used as a record for some data processing. For those who miss the ; at the end of a line of code, you can use them, but the lexer of the compiler …

Member Avatar for vegaseat
1
3K
Member Avatar for ddanbe

This piece of code is far from perfect, but it works! It produces a list of substrings (consisting of digits and letters) and their delimiters. If it is practicaly a sin to manipulate the index of a for loop, then I'm a sinner. If two delimiters follow each other, an …

Member Avatar for xrjf
0
1K
Member Avatar for vegaseat

A function to take a text and extract the string between two given substrings. Allows you to find the nth occurence. Also safeguards against dead ends.

2
1K
Member Avatar for Echo89

Well, I have just made this funtion that will split an array using a delimiter. I'm new to C++ so I will take any suggestions you have. Anyhow, good luck! Enjoy!

Member Avatar for Echo89
0
974
Member Avatar for TrustyTony

This handy function turns file into stream of words stripped of punctuation, whitespace and digits, but does not split for example we'd to two words. If you want that you can further process yielded words or change the definition.

Member Avatar for griswolf
3
2K
Member Avatar for Beat_Slayer

Two litle functions to help on text slice and spliting. The code comments say it all. [CODE]# Slicer takes as arguments a tuple containing the string before, # the string after and the string to truncate. It returns the string # between the two given strings Slicer = lambda((b, a, …

Member Avatar for Beat_Slayer
1
563

The End.