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 60042

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

1 vote

One more LUL and I'm out

Cheddar, 71 bytes i->('One more "'*i).slice(0,-1)+'LUL '+('and I\'m out" '*i).slice(0,-2) Try it online!
Pavel's user avatar
  • 9,397
0 votes

Check If my String is Prime

C# (.NET Core), 60 bytes s=>s.All(i=>Enumerable.Range(2,(int)i-2).All(j=>((int)i)%j))
Pavel's user avatar
  • 9,397
3 votes

Reverse a string by chunks

The /g modifier gives us every match of that regex in the input string as a list, which is then reversed and printed. In Perl, passing a list to say joins it without any delimiter by default. …
Pavel's user avatar
  • 9,397
1 vote

Reverse a string by chunks

APL (Dyalog Classic), 22 bytes {0~⍨∊⊖(⌈⍺÷⍨≢⍵)⍺⍴⍵,⍺⍴0} Try it online!
Pavel's user avatar
  • 9,397
22 votes
22 answers
3k views

Carve a square from a string

Your challenge today is to take a multiline string, and output the biggest square contained within the string that includes the top left corner. … Input is a string or 1D char array; it is not a list of strings. …
Pavel's user avatar
  • 9,397
23 votes
25 answers
3k views

Sort a string by a given ordering

Your challenge is to sort a string, but rather than by the normal alphabetical order (abc..xyz), you will be sorting strings by a specified alphabet. … You must write a program or function that takes two inputs: An alphabet A and an string S. Both will only contain lowercase English letters, and both will contain at least one character. …
Pavel's user avatar
  • 9,397
3 votes

What's the file extension?

C# (Visual C# Interactive Compiler), 22 bytes s=>s.Split('.').Last() Implicit using System.Linq; FTW! Try it online!
Pavel's user avatar
  • 9,397
40 votes
58 answers
4k views

Reverse a string by chunks

Your task is to write a program which, given a number and a string, splits the string into chunks of that size and reverses them. … The string should then be split into chunks of length n, if the length of the string isn't divisible by n any leftover at the end should be considered its own chunk. …
Pavel's user avatar
  • 9,397
0 votes

Make a string into a triangle

Ruby, 31 + 1 = 32 bytes Uses -n flag. a='' $_.each_char{|i|puts a<<i} Try it online!
Pavel's user avatar
  • 9,397
3 votes

Uncomment a COBOL program!

Ruby, 39 38 36 29 23 22 20 + 1 = 21 bytes $_[/.{6}( |.* )/]='' Try it online! Uses -p flag. Explanation: The -p flag adds an implicit block around the code, so the code that actually gets run …
Pavel's user avatar
  • 9,397
2 votes

Make a Word Icicle

C# (Visual C# Interactive Compiler), 129 bytes var s=ReadLine();while(s.Any(c=>c!=32)){WriteLine(s);var i=s.IndexOf(s.Min(c=>c==32?(char)999:c));s=s.Remove(i,1).Insert(i," ");} Try it online!
Pavel's user avatar
  • 9,397
2 votes

Fill in the Blanks, Please!

.*/]} Uses -p The first line is the format string, the rest of the lines are the array. Try it online! …
Pavel's user avatar
  • 9,397
11 votes
2 answers
571 views

Shell Glob Golfing

Your task: Given a string array of paths that represent the "current directory" and a single target path, output the shortest possible string that would expand to only that target path after expanding … The target path can be taken as it's own string, as an index into the array of paths, as the first item on the array of paths passed in, or some other convenient way that isn't hard-coding. …
Pavel's user avatar
  • 9,397
4 votes

"Hello, World!"

uBASIC, 21 bytes 1PRINT"Hello, World!" uBASIC is the most basic BASIC. Exits with an error (no trailing newline). It took me until just now to realize I don't need a space between 1 and PRINT... …
Pavel's user avatar
  • 9,397
3 votes

"Hello, World!"

Threead, 16 bytes "Hello, World!"o Try it online!
Pavel's user avatar
  • 9,397

15 30 50 per page