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 64722

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

0 votes

Make a simple word wrapper

Dart, 112 bytes f(s,n){var l=[''];s.split(' ').forEach((w){if((l.last+w).length<=n)l.last+=w+' ';else l.add(w+' ');});return l;} Try it online!
Elcan's user avatar
  • 1,063
0 votes

Swapping "Good" and "Bad"

Dart, 77 bytes import'dart:io';main()=>print('BadGood'.replaceAll(stdin.readLineSync(),'')); Try it online!
Elcan's user avatar
  • 1,063
0 votes

How much code would a codegolf golf if a codegolf could golf code?

Dart, 61 bytes f(a,b)=>"How much $a would a $a$b $b if a $a$b could $b $a?"; Try it online!
Elcan's user avatar
  • 1,063
0 votes

Reverse stdin and place on stdout

Rust, 57 bytes fn q(s:&str)->String{s.chars().rev().collect::<String>()} Try it online! Dart, 34 bytes f(s)=>s.split('').reversed.join(); Try it online! … Pretty convoluted, you have to get a String List then reverse it and join it back for it to work. …
Elcan's user avatar
  • 1,063
1 vote

Cats go Meow, Cows go Moo

Dart, 114 112 110 104 102 100 bytes f(s)=>s+'s go M'.padRight(s[1]=='a'?s.length+4:0,'e').padRight(2*s.length+2,'o')+(s[1]=='a'?'w':''); Try it online! -2 bytes : Changed the way the u offset is c …
Elcan's user avatar
  • 1,063
0 votes

Text compression

Dart,  124 120  117 bytes f(){var s='Peter Piper picked',t=' peck of pickled peppers';return"$s a$t.\nA$t $s.\nIf $s a$t,\nWhere's the$t $s?";} -4 bytes by declaring both variables on the same row …
Elcan's user avatar
  • 1,063
0 votes

String analyser

Dart, 83 bytes 'AWSALILAND'.runes.forEach((r)=>print(String.fromCharCodes(List.filled(r-64, r)))); Try it online!
Elcan's user avatar
  • 1,063
1 vote

Make me a square!

Dart, 30 bytes f(s)=>'$s$s$s\n$s $s\n$s$s$s'; Try it online!
Elcan's user avatar
  • 1,063
0 votes

There are known knowns

Dart, 62 61 bytes g({s='known'})=>"$s $s\s\n$s un$s\s\nun$s $s\s\nun$s un$s\s"; Try it online!
Elcan's user avatar
  • 1,063
0 votes

Compare version numbers

Dart, 277 231 bytes F(s,{t}){t=s.split('.').map(int.parse).toList();while(t.last<1)t.removeLast();return t;}f(a,b,{d,e,f,g,h,i=0}){d=F(b);e=F(a);g=d.length;h=e.length;f=h>g?g:h;for(;i<f;i++)if(e[i]!= …
Elcan's user avatar
  • 1,063
0 votes

What my dog really hears

Dart, 99 bytes f(s)=>s.replaceAllMapped(RegExp(r'(rex)|(\w)',caseSensitive:false),(Match m)=>m[1]!=null?m[1]:'*'); Try it online!
Elcan's user avatar
  • 1,063
0 votes

Do you want to code a snowman?

Dart, 307 bytes f(i,{r='.o0-',s=' : '}){i=i.split('').map((j)=>int.parse(j)-1).toList();return' ${['_===_',' ___ \n.....',' /_\\ ',' ___ \n (_*_)'][i[0]]}\n${' \\ '[i[4]]}(${r[i[2]]+',._ '[i[1]]+r[i …
Elcan's user avatar
  • 1,063
2 votes

Oreoorererereoo

Dart, 120 106 107 bytes f(s)=>s.replaceAll('o',''.padRight(s.length,'#')+'\n').replaceAll('re',' '.padRight(s.length-1,'-')+' \n'); Try it online! +1 byte : Added trailing whitespace
Elcan's user avatar
  • 1,063
0 votes

Would this string work as string?

Dart, 94 bytes f(s)=>!(r'//,\\,~/,_\,~_,_~,/_,\~'.split(',').map((t)=>s.contains(t)).fold(false,(p,e)=>p|e)); Try it online!
Elcan's user avatar
  • 1,063
2 votes

String to Bit Transition

0':'1';t[0]='1';return t.join();} Previous one-liner f(String s)=>'1'+s.runes.map((r)=>r.toRadixString(2).padLeft(7,'0')).join().split('').toList().reversed.reduce((p,e)=>p.substring(0,p.length-1)+( …
Elcan's user avatar
  • 1,063

15 30 50 per page