Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options questions only not deleted user 52915

A string is a sequence of characters. It is commonly used to represent text or a sequence of bytes. Use this tag along with the appropriate programming language being used.

19 votes
5 answers
8k views

Check whether string ends with string

I wrote the following to check whether a string ends with a second string. function isEndOf(origin, target) { return (origin.substr(target.length * -1, target.length) === target); } Usage: isEnd …
Mast's user avatar
  • 13.5k
7 votes
1 answer
133 views

Zalera calculator

I recently started replaying Final Fantasy XII. One of its optional bosses, Zalera, has, among others, the following mechanics: His attack sequence is Lv. 2 Sleep, Lv. 3 Disable, Lv. 4 Break and Lv. …
Mast's user avatar
  • 13.5k
78 votes
1 answer
6k views

NUMAH LITTERS OV KITTEHS ON TEH NETZ

It's not fair that 1% of the users hold 75% of the lolcode questions. #OccupyMatsMug ~ user2296177 I agree. Without further ado, here's the LOLCODE version of 99 bottles of beer on the wall: …
Mast's user avatar
  • 13.5k
21 votes
6 answers
4k views

Find the longest word's length

The challenge is simple: Return the length of the longest word in the provided sentence. The solution is just as simple: function findLongestWord(str) { arr = str.split(' '); size = 0; fo …
Mast's user avatar
  • 13.5k
8 votes
3 answers
168 views

A guarded FizzBuzz

Vogel612 and I decided to take a shot at the StackSTV challenge in Haskell. This is part of the CRitter Collaboration challenge. Except I don't know any Haskell. So let's try a FizzBuzz first! I'm qu …
Mast's user avatar
  • 13.5k
9 votes
3 answers
499 views

n number of x on the y

Everyone knows "99 bottles of beer on the wall". Mat's Mug made a comment about mugs on the wall in The 2nd Monitor and I realized I never wrote a "beer on the wall" program. But that seemed way too …
Mast's user avatar
  • 13.5k
6 votes
3 answers
1k views

The Genetic Code

Protein strings are constructed from these 20 symbols. Henceforth, the term genetic string will incorporate protein strings along with DNA strings and RNA strings. …
Mast's user avatar
  • 13.5k
7 votes
3 answers
22k views

Output two columns

Output formatting: Input Format Every line of input will contain a String followed by an integer. Each String will have a maximum of 10 alphabetic characters, and each integer will be in th …
Mast's user avatar
  • 13.5k
11 votes
5 answers
7k views

ASCII generator

Today I stumbled upon CodinGame, a site with programming challenges. I'll describe one of them. ASCII art allows you to represent forms by using characters. To be precise, in our case, these forms …
Mast's user avatar
  • 13.5k
8 votes
1 answer
218 views

A database of books, part 1

Backstory I collect books. A lot of books. Whitepapers, (programming) cookbooks, transcripts, important letters, overviews, you name it. Usually in PDF, otherwise my house would be too small. To keep …
Mast's user avatar
  • 13.5k
5 votes
2 answers
582 views

Library assistant

HackerRank currently has '7 days of JavaScript' going, a quick intro into the JavaScript language. Every day a couple of challenges will be made available. One of the challenges of today was this: …
Mast's user avatar
  • 13.5k
2 votes
2 answers
118 views

A sequence of mistakes

Problem: HAMM Given two strings \$s\$ and \$t\$ of equal length, the Hamming distance between \$s\$ and \$t\$, denoted \$d_H(s,t)\$, is the number of corresponding symbols that differ in \$s\$ and … Given: Two DNA strings \$s\$ and \$t\$ of equal length (not exceeding 1 kbp). Return: The Hamming distance \$d_H(s,t)\$. …
Mast's user avatar
  • 13.5k
8 votes
1 answer
546 views

Calculating protein mass

This question is part of a series solving the Rosalind challenges. For the previous question in this series, see A sequence of mistakes. The repository with all my up-to-date solutions so far can be f …
Mast's user avatar
  • 13.5k
17 votes
2 answers
729 views

How to speak Brainfuck: for beginners

The following code transforms multi-line input into the the Brainfuck equivalent. One line turns into one program. The resulting programs are split by newlines for readability. Brainf.cpp #include " …
Mast's user avatar
  • 13.5k