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 not deleted user 30525

A competition to solve a particular problem through the usage and manipulation of strings.

8 votes

Increment every number in a string

Python 2 - 59 Supply the string as the variable n import re;print re.sub('\d+',lambda x:`int(x.group())+1`,n) …
Beta Decay's user avatar
  • 23.4k
0 votes

Practical Golf - US States

Javascript I know this isn't code golf, but I want to golf it anyway. :) var r=new XMLHttpRequest r.open("GET","https://gist.githubusercontent.com/mshafrir/2646763/raw/f2a89b57193e71010386a7397 …
Beta Decay's user avatar
  • 23.4k
3 votes

Is it simple or is it hard?

Python 3, 148 bytes import re print(all(i in open("most used.txt").read().lower().split(' ')for i in re.sub("[^a-z ']+","",input().replace("-"," ").lower()).split(" "))) Outputs True and False Exa …
Beta Decay's user avatar
  • 23.4k
4 votes

Surround a string with hashes

Python 3, 88 bytes Thanks @WorldSEnder s=" ";n=s+input()+s b=len(n) h="#";x=h*(b+2);y=h+s*b+h;z="\n" print(x+z+y+z+h+n+h+z+y+z+x) Example I/O: This is a test ################## # # …
Beta Decay's user avatar
  • 23.4k
6 votes

Don't google "google"

JavaScript, 47 bytes Nice and simple. Edit: Now complies with the rules function f(g){if(g=="google")a;return g.length} Testing Error thrown function f(g){if(g=="google")a;return g.length} …
Beta Decay's user avatar
  • 23.4k
4 votes

Implement "tac": Print lines from a file in reverse

Python 2, 52 bytes import sys;print''.join(sys.stdin.readlines()[::-1])
Beta Decay's user avatar
  • 23.4k
0 votes

Halloween Golf: The 2spooky4me Challenge!

Fourier, 32 bytes I~zo115a-3avaa-4a121az+2o109a-8a Still using @isaacg's golfing algorithm ;)
Beta Decay's user avatar
  • 23.4k
4 votes

The Squiggly Sequence

Fourier, 27 bytes 92~SI~N%2{1}{47~S}N(Sai^~i) Try it online!
Beta Decay's user avatar
  • 23.4k
3 votes

Slowly turn a string into another

Python 3, 104 bytes Meh. n='\n';lambda x,y:x+n+n.join(x[:-i]for i in range(1,len(x)-1))+n+n.join(y[:i]for i in range(1,len(y)+1)) Thanks to @DJMcMayhem for golfing 21 bytes off. Ideone it!
Beta Decay's user avatar
  • 23.4k
1 vote

Stringsplode the String!

Python 3, 47 bytes Thanks to @deustice lambda s:''.join(s[:i]for i in range(len(s)+1)) Ideone it!
Beta Decay's user avatar
  • 23.4k
1 vote

Make me a bad fade animation... please

Python 3, 214 bytes import time,random o,f=list(input()),list(input()) F=len(f);O=len(o);o+=[" "]*(F-O);f+=[" "]*(O-F);p=-1;l=[p] while o!=f: while p in l:p=random.randrange(max(F,O)) l+=[p];o[p]=f …
Beta Decay's user avatar
  • 23.4k
1 vote

Appending Numbers

When inputting a string, enclose it in quotation marks Explanation: I - Push input to stack "\d+$" - Push string to stack - - Remove characters from first string which match the regex I … - Push input to stack + - Append to the first string P - Print top item of stack …
Beta Decay's user avatar
  • 23.4k
1 vote

The shortest code to invert bit-wise a binary string

Loops through each character in the string, inverting each character. … Explanation: I - Push input to stack ~s - Store the top of the stack in the variable s L - Pop string off the top and push its length ( - Pop off the stack and repeat code between brackets until stack …
Beta Decay's user avatar
  • 23.4k
0 votes

Remove vowels without using too many different characters

Uses the regex [aeiouAEIOU] to remove the vowels from the input string. …
Beta Decay's user avatar
  • 23.4k
24 votes

Longest Common Prefix of 2 Strings

Python 3, 54 bytes Thanks Python for having a built-in function for this task! :D import os;print(os.path.commonprefix(input().split())) Takes input as two words separated by a space such as gloss …
Beta Decay's user avatar
  • 23.4k

15 30 50 per page