Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does ? do in Elixir

Tags:

elixir

I am aware of String.strip/2, but I cannot figure out its usage for removing whitespaces.

String.strip "_some_", ?_   #=> "some"

If the string had whitespaces instead of _, how does one strip them? Also, it would be great if someone can explain what ? means here.

like image 289
Alex Avatar asked Nov 18 '14 13:11

Alex


People also ask

What does the symbol mean in Elixir?

The @ symbol in Elixir denotes module attributes, which are useful compile-time settings. You often see them in places where you might put class constants in an OO language.

What does |> mean in Elixir?

This is the pipe operator. From the linked docs: This operator introduces the expression on the left-hand side as the first argument to the function call on the right-hand side. Examples.

What can I do with Elixir?

Elixir is used by a ton of companies: Adobe used Elixir to build a client/cloud application for a collaborative photography workflow. Discord uses Elixir for their large-scale messaging system that you have probably heard about.

What does def mean in syntax?

A Design Exchange Format (DEF) file contains the design-specific information of a circuit and is a representation of the design at any point during the layout process. The DEF file is an ASCII representation using the syntax conventions described in "Typographic and Syntax Conventions".


1 Answers

The question mark preceding a character returns its codepoint, it's mentioned in this section of the getting started guide: http://elixir-lang.org/getting-started/binaries-strings-and-char-lists.html

like image 200
Adam Kittelson Avatar answered Oct 03 '22 23:10

Adam Kittelson