Search
 
SCRIPT & CODE EXAMPLE
 

ELIXIR

elixir Creating Custom Sigils

defmodule MySigils do
  #returns the downcasing string if option l is given then returns the list of downcase letters
  def sigil_l(string,[]), do: String.downcase(string)
  def sigil_l(string,[?l]), do: String.downcase(string) |> String.graphemes

  #returns the upcasing string if option l is given then returns the list of downcase letters
  def sigil_u(string,[]), do: String.upcase(string)
  def sigil_u(string,[?l]), do: String.upcase(string) |> String.graphemes
end

iex> import MySigils
iex> ~l/HELLO/
"hello"
iex> ~l/HELLO/l
["h", "e", "l", "l", "o"]
iex> ~u/hello/
"HELLO"
iex> ~u/hello/l
["H", "E", "L", "L", "O"]
Comment

PREVIOUS NEXT
Code Example
Elixir :: elixir function guards 
Elixir :: elixir error 
Scala :: scala schemaPayload json 
Scala :: array in scala 
Scala :: new scala project 
Scala :: scala pattern matching 
Scala :: scala yield how to share one loop 
Scala :: how to print message in scala 
Actionscript :: bs modal is working but not visible 
Actionscript :: docker compose enable rabbitmq enable plugins 
Excel :: excel formula update insert row column 
Excel :: or in excel 
Perl :: perl loops 
Perl :: perl split array into smaller arrays 
Pascal :: take console input in pascal 
Pascal :: for loop pascal 
Powershell :: call function powershell 
Gdscript :: godot 2d set position to mouse 
Abap :: abap if statement 
Assembly :: program in assembly language to find even numbers from 1 to 10 
Assembly :: glsl uniform struct 
Assembly :: tqdm iterate over range 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: datatable disable searching 
Javascript :: js random hex color 
Javascript :: WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jquery 
Javascript :: jquery slim min js url 
Javascript :: js element exists 
Javascript :: select2 in modal not work 
Javascript :: angular validators number only in reactive form 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =