str2B: round real in string

Description Usage Arguments Value Author(s) Examples

Description

Function for rounding real given as string representation

Usage

1
  str2B(str, base=10, round = 0)

Arguments

str

String representing a real

base

1 < integer < 17, base of representation

round

Integer, number of places after "." to be rounded; < 0: rounding places before least significand digit. If too negative, 0 will result.

Value

str2B from given string represention of x, round to 'round' decimal digits

Author(s)

Christian W. Hoffmann <christian@echoffmann.ch>

Examples

1
2
3
4
  x <- paste0("-    ","9167.8")
  str2B(x )
  for ( kk in -5:4) print(str2B(x,10,kk) )
# 0 -10000 -9000 -9200 -9170 -9168 -9167.8 ...

cwhmisc documentation built on May 1, 2019, 7:55 p.m.