Skip to content

Miscellaneous operators

Operators that no other group holds.

Every program can use these operators. No import is necessary.

Operator Arguments Gives
? condition: boolean, left: T, right: T T
+ left: double, right: string string
+ left: int, right: string string
buffer_alloc size: int buffer
buffer_get buf: buffer, offset: int int
buffer_length buf: buffer int
buffer_slice buf: buffer, start: int, end: int buffer
buffer_to_base64 buf: buffer string
buffer_to_string buf: buffer string
charAt text: charbuffer, position: int char
double_buffer_alloc size: int double_buffer
double_buffer_get buf: double_buffer, index: int double
double_buffer_length buf: double_buffer int
double2str value: double string
http_get_header req: HttpRequest, name: string string
http_get_method req: HttpRequest string
http_get_param req: HttpRequest, name: string string
http_get_path req: HttpRequest string
http_get_query req: HttpRequest, name: string string
int_buffer_alloc size: int int_buffer
int_buffer_get buf: int_buffer, index: int int
int_buffer_length buf: int_buffer int
length buffer: charbuffer int
proc_hibernate proc: RangerProcessBase string
rawbytechar code: int string
shell_arg index: int string
strfromcode code: char string
strfromcode code: int string
substring text: charbuffer, start: int, end: int string
to_int ch: char int
to_string value: boolean string
to_string text: charbuffer string
to_string value: double string
to_string value: int string
toString text: charbuffer string

Target support marks

  • Own template
  • Default template
  • No template

The operator works for a target with an own template and for a target with the default template. The default template is the * entry of the definition: it writes the same code for every target that has no template of its own. A target with no template writes no code, and a program that uses the operator does not compile for that target.

?

(? condition left right) → T
?(condition: boolean, left: T, right: T)

Target support

  • JavaScript: default template
  • TypeScript: default template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: default template
  • Kotlin: own template
  • Dart: default template
  • Swift: default template
  • C#: default template
  • C++: own template
  • PHP: default template
  • Scala: own template

Definition: compiler/Lang.rgr, line 4881

+

(+ left right) → string
+(left: double, right: string)

Target support

  • JavaScript: default template
  • TypeScript: default template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: default template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: default template
  • C++: own template
  • PHP: own template
  • Scala: default template

Definition: compiler/Lang.rgr, line 4748

+

(+ left right) → string
+(left: int, right: string)

Target support

  • JavaScript: default template
  • TypeScript: default template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: default template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: default template
  • C++: own template
  • PHP: own template
  • Scala: default template

Definition: compiler/Lang.rgr, line 4781

buffer_alloc

(buffer_alloc size) → buffer
buffer_alloc(size: int)

Allocate a new buffer of specified size (zero-filled)

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: no template

Definition: compiler/Lang.rgr, line 6763

buffer_get

(buffer_get buf offset) → int
buffer_get(buf: buffer, offset: int)

Read a single byte at offset (returns 0-255)

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: no template

Definition: compiler/Lang.rgr, line 6835

buffer_length

(buffer_length buf) → int
buffer_length(buf: buffer)

Get the length of a buffer in bytes

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: no template

Definition: compiler/Lang.rgr, line 6816

buffer_slice

(buffer_slice buf start end) → buffer
buffer_slice(buf: buffer, start: int, end: int)

Create a slice/copy of a buffer range

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: no template

Definition: compiler/Lang.rgr, line 7081

buffer_to_base64

(buffer_to_base64 buf) → string
buffer_to_base64(buf: buffer)

Convert buffer to Base64 encoded string

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: no template

Definition: compiler/Lang.rgr, line 6938

buffer_to_string

(buffer_to_string buf) → string
buffer_to_string(buf: buffer)

Convert buffer to string (UTF-8 decoded)

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: no template

Definition: compiler/Lang.rgr, line 6891

charAt

(charAt text position) → char
charAt(text: charbuffer, position: int)

ONE BYTE, 0..255, at that index. Not one character: a character outside ASCII is two, three or four of these, so this is the operator to reach for when the subject really is bytes and the wrong one for walking text. See the block above the charbuffer overloads.

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: own template

Definition: compiler/Lang.rgr, line 7831

double_buffer_alloc

(double_buffer_alloc size) → double_buffer
double_buffer_alloc(size: int)

Allocate a new double_buffer of specified size (zero-filled)

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: no template
  • Scala: no template

Definition: compiler/Lang.rgr, line 7239

double_buffer_get

(double_buffer_get buf index) → double
double_buffer_get(buf: double_buffer, index: int)

Read a double at index

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: no template
  • Scala: no template

Definition: compiler/Lang.rgr, line 7273

double_buffer_length

(double_buffer_length buf) → int
double_buffer_length(buf: double_buffer)

Get the length of a double_buffer

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: no template
  • Scala: no template

Definition: compiler/Lang.rgr, line 7256

double2str

(double2str value) → string
double2str(value: double)

std::to_string(myDoubleVar);

Target support

  • JavaScript: default template
  • TypeScript: default template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: default template
  • Dart: default template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: own template

Definition: compiler/Lang.rgr, line 8523

http_get_header

(http_get_header req name) → string
http_get_header(req: HttpRequest, name: string)

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: default template
  • Python: default template
  • Java: default template
  • Kotlin: default template
  • Dart: default template
  • Swift: default template
  • C#: default template
  • C++: default template
  • PHP: default template
  • Scala: default template

Definition: compiler/Lang.rgr, line 11693

http_get_method

(http_get_method req) → string
http_get_method(req: HttpRequest)

HTTP Request Operators

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: default template
  • Python: default template
  • Java: default template
  • Kotlin: default template
  • Dart: default template
  • Swift: default template
  • C#: default template
  • C++: default template
  • PHP: default template
  • Scala: default template

Definition: compiler/Lang.rgr, line 11661

http_get_param

(http_get_param req name) → string
http_get_param(req: HttpRequest, name: string)

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: default template
  • Python: default template
  • Java: default template
  • Kotlin: default template
  • Dart: default template
  • Swift: default template
  • C#: default template
  • C++: default template
  • PHP: default template
  • Scala: default template

Definition: compiler/Lang.rgr, line 11677

http_get_path

(http_get_path req) → string
http_get_path(req: HttpRequest)

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: default template
  • Python: default template
  • Java: default template
  • Kotlin: default template
  • Dart: default template
  • Swift: default template
  • C#: default template
  • C++: default template
  • PHP: default template
  • Scala: default template

Definition: compiler/Lang.rgr, line 11669

http_get_query

(http_get_query req name) → string
http_get_query(req: HttpRequest, name: string)

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: default template
  • Python: default template
  • Java: default template
  • Kotlin: default template
  • Dart: default template
  • Swift: default template
  • C#: default template
  • C++: default template
  • PHP: default template
  • Scala: default template

Definition: compiler/Lang.rgr, line 11685

int_buffer_alloc

(int_buffer_alloc size) → int_buffer
int_buffer_alloc(size: int)

Allocate a new int_buffer of specified size (zero-filled)

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: no template
  • Scala: no template

Definition: compiler/Lang.rgr, line 7107

int_buffer_get

(int_buffer_get buf index) → int
int_buffer_get(buf: int_buffer, index: int)

Read an int64 at index

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: no template
  • Scala: no template

Definition: compiler/Lang.rgr, line 7143

int_buffer_length

(int_buffer_length buf) → int
int_buffer_length(buf: int_buffer)

Get the length of an int_buffer

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: no template
  • Scala: no template

Definition: compiler/Lang.rgr, line 7126

length

(length buffer) → int
length(buffer: charbuffer)

Length HOW MANY BYTES. For text that is not ASCII this is more than the number of characters -- `char_length` is that one. See the block above the charbuffer overloads.

Target support

  • JavaScript: default template
  • TypeScript: default template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: default template
  • Swift: default template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: own template

Definition: compiler/Lang.rgr, line 7401

proc_hibernate

(proc_hibernate proc) → string
proc_hibernate(proc: RangerProcessBase)

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: default template
  • Rust: default template
  • Python: default template
  • Java: default template
  • Kotlin: own template
  • Dart: default template
  • Swift: own template
  • C#: default template
  • C++: default template
  • PHP: default template
  • Scala: default template

Definition: compiler/Lang.rgr, line 11872

rawbytechar

(rawbytechar code) → string
rawbytechar(code: int)

Raw byte to string - for binary protocols like PDF WinAnsiEncoding Unlike strfromcode, this produces a single raw byte, not UTF-8 encoded

Target support

  • JavaScript: default template
  • TypeScript: default template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: default template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: own template

Definition: compiler/Lang.rgr, line 8462

shell_arg

(shell_arg index) → string
shell_arg(index: int)

Command line arguments

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: no template

Definition: compiler/Lang.rgr, line 1562

strfromcode

(strfromcode code) → string
strfromcode(code: char)

Target support

  • JavaScript: default template
  • TypeScript: default template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: default template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: own template

Definition: compiler/Lang.rgr, line 8340

strfromcode

(strfromcode code) → string
strfromcode(code: int)

Target support

  • JavaScript: default template
  • TypeScript: default template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: default template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: own template

Definition: compiler/Lang.rgr, line 8402

substring

(substring text start end) → string
substring(text: charbuffer, start: int, end: int)

The TEXT that this range of bytes is the UTF-8 of. One of the three places the line between bytes and text is crossed, so it decodes: a range that cuts a character in half gives a replacement character, which is what makes a one-byte-at-a-time copy of a buffer back into a string wrong. See the block above.

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: own template

Definition: compiler/Lang.rgr, line 6368

to_int

(to_int ch) → int
to_int(ch: char)

Target support

  • JavaScript: default template
  • TypeScript: default template
  • Go: own template
  • Rust: own template
  • Python: default template
  • Java: default template
  • Kotlin: own template
  • Dart: default template
  • Swift: default template
  • C#: own template
  • C++: default template
  • PHP: own template
  • Scala: own template

Definition: compiler/Lang.rgr, line 7377

to_string

(to_string value) → string
to_string(value: boolean)

Target support

  • JavaScript: default template
  • TypeScript: default template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: default template
  • Dart: default template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: own template

Definition: compiler/Lang.rgr, line 8597

to_string

(to_string text) → string
to_string(text: charbuffer)

The TEXT these bytes are the UTF-8 of -- the other direction of `to_charbuffer`. Bytes that are not valid UTF-8 come back as replacement characters; a buffer holding a PNG has no text in it and this operator has nothing to say about one.

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: default template
  • PHP: default template
  • Scala: own template

Definition: compiler/Lang.rgr, line 6415

to_string

(to_string value) → string
to_string(value: double)

Target support

  • JavaScript: default template
  • TypeScript: default template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: default template
  • Dart: default template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: own template

Definition: compiler/Lang.rgr, line 8558

to_string

(to_string value) → string
to_string(value: int)

Target support

  • JavaScript: default template
  • TypeScript: default template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: default template
  • Dart: default template
  • Swift: own template
  • C#: own template
  • C++: own template
  • PHP: own template
  • Scala: own template

Definition: compiler/Lang.rgr, line 8505

toString

(toString text) → string
toString(text: charbuffer)

...and the same thing under the method-call spelling.

Target support

  • JavaScript: own template
  • TypeScript: own template
  • Go: own template
  • Rust: own template
  • Python: own template
  • Java: own template
  • Kotlin: own template
  • Dart: own template
  • Swift: own template
  • C#: own template
  • C++: default template
  • PHP: default template
  • Scala: own template

Definition: compiler/Lang.rgr, line 6444

Ranger 3.5.1 · commit f323fd4 · development build