@ -59,19 +59,19 @@ const (
criteriaErr
criteriaRegexp
cat goryWeightAndMass
cat goryDistance
cat goryTime
cat goryPressure
cat goryForce
cat goryEnergy
cat goryPower
cat goryMagnetism
cat goryTemperature
cat goryVolumeAndLiquidMeasure
cat goryArea
cat goryInformation
cat gorySpeed
cat e goryWeightAndMass
cat e goryDistance
cat e goryTime
cat e goryPressure
cat e goryForce
cat e goryEnergy
cat e goryPower
cat e goryMagnetism
cat e goryTemperature
cat e goryVolumeAndLiquidMeasure
cat e goryArea
cat e goryInformation
cat e gorySpeed
matchModeExact = 0
matchModeMinGreater = 1
@ -2144,177 +2144,177 @@ type conversionUnit struct {
// formula function CONVERT.
var conversionUnits = map [ string ] conversionUnit {
// weight and mass
"g" : { group : cat goryWeightAndMass, allowPrefix : true } ,
"sg" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"lbm" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"u" : { group : cat goryWeightAndMass, allowPrefix : true } ,
"ozm" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"grain" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"cwt" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"shweight" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"uk_cwt" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"lcwt" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"hweight" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"stone" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"ton" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"uk_ton" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"LTON" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"brton" : { group : cat goryWeightAndMass, allowPrefix : false } ,
"g" : { group : cat e goryWeightAndMass, allowPrefix : true } ,
"sg" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"lbm" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"u" : { group : cat e goryWeightAndMass, allowPrefix : true } ,
"ozm" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"grain" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"cwt" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"shweight" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"uk_cwt" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"lcwt" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"hweight" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"stone" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"ton" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"uk_ton" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"LTON" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
"brton" : { group : cat e goryWeightAndMass, allowPrefix : false } ,
// distance
"m" : { group : cat goryDistance, allowPrefix : true } ,
"mi" : { group : cat goryDistance, allowPrefix : false } ,
"Nmi" : { group : cat goryDistance, allowPrefix : false } ,
"in" : { group : cat goryDistance, allowPrefix : false } ,
"ft" : { group : cat goryDistance, allowPrefix : false } ,
"yd" : { group : cat goryDistance, allowPrefix : false } ,
"ang" : { group : cat goryDistance, allowPrefix : true } ,
"ell" : { group : cat goryDistance, allowPrefix : false } ,
"ly" : { group : cat goryDistance, allowPrefix : false } ,
"parsec" : { group : cat goryDistance, allowPrefix : false } ,
"pc" : { group : cat goryDistance, allowPrefix : false } ,
"Pica" : { group : cat goryDistance, allowPrefix : false } ,
"Picapt" : { group : cat goryDistance, allowPrefix : false } ,
"pica" : { group : cat goryDistance, allowPrefix : false } ,
"survey_mi" : { group : cat goryDistance, allowPrefix : false } ,
"m" : { group : cat e goryDistance, allowPrefix : true } ,
"mi" : { group : cat e goryDistance, allowPrefix : false } ,
"Nmi" : { group : cat e goryDistance, allowPrefix : false } ,
"in" : { group : cat e goryDistance, allowPrefix : false } ,
"ft" : { group : cat e goryDistance, allowPrefix : false } ,
"yd" : { group : cat e goryDistance, allowPrefix : false } ,
"ang" : { group : cat e goryDistance, allowPrefix : true } ,
"ell" : { group : cat e goryDistance, allowPrefix : false } ,
"ly" : { group : cat e goryDistance, allowPrefix : false } ,
"parsec" : { group : cat e goryDistance, allowPrefix : false } ,
"pc" : { group : cat e goryDistance, allowPrefix : false } ,
"Pica" : { group : cat e goryDistance, allowPrefix : false } ,
"Picapt" : { group : cat e goryDistance, allowPrefix : false } ,
"pica" : { group : cat e goryDistance, allowPrefix : false } ,
"survey_mi" : { group : cat e goryDistance, allowPrefix : false } ,
// time
"yr" : { group : cat goryTime, allowPrefix : false } ,
"day" : { group : cat goryTime, allowPrefix : false } ,
"d" : { group : cat goryTime, allowPrefix : false } ,
"hr" : { group : cat goryTime, allowPrefix : false } ,
"mn" : { group : cat goryTime, allowPrefix : false } ,
"min" : { group : cat goryTime, allowPrefix : false } ,
"sec" : { group : cat goryTime, allowPrefix : true } ,
"s" : { group : cat goryTime, allowPrefix : true } ,
"yr" : { group : cat e goryTime, allowPrefix : false } ,
"day" : { group : cat e goryTime, allowPrefix : false } ,
"d" : { group : cat e goryTime, allowPrefix : false } ,
"hr" : { group : cat e goryTime, allowPrefix : false } ,
"mn" : { group : cat e goryTime, allowPrefix : false } ,
"min" : { group : cat e goryTime, allowPrefix : false } ,
"sec" : { group : cat e goryTime, allowPrefix : true } ,
"s" : { group : cat e goryTime, allowPrefix : true } ,
// pressure
"Pa" : { group : cat goryPressure, allowPrefix : true } ,
"p" : { group : cat goryPressure, allowPrefix : true } ,
"atm" : { group : cat goryPressure, allowPrefix : true } ,
"at" : { group : cat goryPressure, allowPrefix : true } ,
"mmHg" : { group : cat goryPressure, allowPrefix : true } ,
"psi" : { group : cat goryPressure, allowPrefix : true } ,
"Torr" : { group : cat goryPressure, allowPrefix : true } ,
"Pa" : { group : cat e goryPressure, allowPrefix : true } ,
"p" : { group : cat e goryPressure, allowPrefix : true } ,
"atm" : { group : cat e goryPressure, allowPrefix : true } ,
"at" : { group : cat e goryPressure, allowPrefix : true } ,
"mmHg" : { group : cat e goryPressure, allowPrefix : true } ,
"psi" : { group : cat e goryPressure, allowPrefix : true } ,
"Torr" : { group : cat e goryPressure, allowPrefix : true } ,
// force
"N" : { group : cat goryForce, allowPrefix : true } ,
"dyn" : { group : cat goryForce, allowPrefix : true } ,
"dy" : { group : cat goryForce, allowPrefix : true } ,
"lbf" : { group : cat goryForce, allowPrefix : false } ,
"pond" : { group : cat goryForce, allowPrefix : true } ,
"N" : { group : cat e goryForce, allowPrefix : true } ,
"dyn" : { group : cat e goryForce, allowPrefix : true } ,
"dy" : { group : cat e goryForce, allowPrefix : true } ,
"lbf" : { group : cat e goryForce, allowPrefix : false } ,
"pond" : { group : cat e goryForce, allowPrefix : true } ,
// energy
"J" : { group : cat goryEnergy, allowPrefix : true } ,
"e" : { group : cat goryEnergy, allowPrefix : true } ,
"c" : { group : cat goryEnergy, allowPrefix : true } ,
"cal" : { group : cat goryEnergy, allowPrefix : true } ,
"eV" : { group : cat goryEnergy, allowPrefix : true } ,
"ev" : { group : cat goryEnergy, allowPrefix : true } ,
"HPh" : { group : cat goryEnergy, allowPrefix : false } ,
"hh" : { group : cat goryEnergy, allowPrefix : false } ,
"Wh" : { group : cat goryEnergy, allowPrefix : true } ,
"wh" : { group : cat goryEnergy, allowPrefix : true } ,
"flb" : { group : cat goryEnergy, allowPrefix : false } ,
"BTU" : { group : cat goryEnergy, allowPrefix : false } ,
"btu" : { group : cat goryEnergy, allowPrefix : false } ,
"J" : { group : cat e goryEnergy, allowPrefix : true } ,
"e" : { group : cat e goryEnergy, allowPrefix : true } ,
"c" : { group : cat e goryEnergy, allowPrefix : true } ,
"cal" : { group : cat e goryEnergy, allowPrefix : true } ,
"eV" : { group : cat e goryEnergy, allowPrefix : true } ,
"ev" : { group : cat e goryEnergy, allowPrefix : true } ,
"HPh" : { group : cat e goryEnergy, allowPrefix : false } ,
"hh" : { group : cat e goryEnergy, allowPrefix : false } ,
"Wh" : { group : cat e goryEnergy, allowPrefix : true } ,
"wh" : { group : cat e goryEnergy, allowPrefix : true } ,
"flb" : { group : cat e goryEnergy, allowPrefix : false } ,
"BTU" : { group : cat e goryEnergy, allowPrefix : false } ,
"btu" : { group : cat e goryEnergy, allowPrefix : false } ,
// power
"HP" : { group : cat goryPower, allowPrefix : false } ,
"h" : { group : cat goryPower, allowPrefix : false } ,
"W" : { group : cat goryPower, allowPrefix : true } ,
"w" : { group : cat goryPower, allowPrefix : true } ,
"PS" : { group : cat goryPower, allowPrefix : false } ,
"T" : { group : cat goryMagnetism, allowPrefix : true } ,
"ga" : { group : cat goryMagnetism, allowPrefix : true } ,
"HP" : { group : cat e goryPower, allowPrefix : false } ,
"h" : { group : cat e goryPower, allowPrefix : false } ,
"W" : { group : cat e goryPower, allowPrefix : true } ,
"w" : { group : cat e goryPower, allowPrefix : true } ,
"PS" : { group : cat e goryPower, allowPrefix : false } ,
"T" : { group : cat e goryMagnetism, allowPrefix : true } ,
"ga" : { group : cat e goryMagnetism, allowPrefix : true } ,
// temperature
"C" : { group : cat goryTemperature, allowPrefix : false } ,
"cel" : { group : cat goryTemperature, allowPrefix : false } ,
"F" : { group : cat goryTemperature, allowPrefix : false } ,
"fah" : { group : cat goryTemperature, allowPrefix : false } ,
"K" : { group : cat goryTemperature, allowPrefix : false } ,
"kel" : { group : cat goryTemperature, allowPrefix : false } ,
"Rank" : { group : cat goryTemperature, allowPrefix : false } ,
"Reau" : { group : cat goryTemperature, allowPrefix : false } ,
"C" : { group : cat e goryTemperature, allowPrefix : false } ,
"cel" : { group : cat e goryTemperature, allowPrefix : false } ,
"F" : { group : cat e goryTemperature, allowPrefix : false } ,
"fah" : { group : cat e goryTemperature, allowPrefix : false } ,
"K" : { group : cat e goryTemperature, allowPrefix : false } ,
"kel" : { group : cat e goryTemperature, allowPrefix : false } ,
"Rank" : { group : cat e goryTemperature, allowPrefix : false } ,
"Reau" : { group : cat e goryTemperature, allowPrefix : false } ,
// volume
"l" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"L" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"lt" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"tsp" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"tspm" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"tbs" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"oz" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"cup" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"pt" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"us_pt" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"uk_pt" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"qt" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"uk_qt" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"gal" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"uk_gal" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"ang3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"ang^3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"barrel" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"bushel" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"in3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"in^3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"ft3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"ft^3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"ly3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"ly^3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"m3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"m^3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"mi3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"mi^3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"yd3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"yd^3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"Nmi3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"Nmi^3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"Pica3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"Pica^3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"Picapt3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"Picapt^3" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"GRT" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"regton" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"MTON" : { group : cat goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"l" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"L" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"lt" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"tsp" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"tspm" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"tbs" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"oz" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"cup" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"pt" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"us_pt" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"uk_pt" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"qt" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"uk_qt" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"gal" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"uk_gal" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"ang3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"ang^3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"barrel" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"bushel" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"in3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"in^3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"ft3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"ft^3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"ly3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"ly^3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"m3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"m^3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : true } ,
"mi3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"mi^3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"yd3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"yd^3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"Nmi3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"Nmi^3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"Pica3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"Pica^3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"Picapt3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"Picapt^3" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"GRT" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"regton" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
"MTON" : { group : cat e goryVolumeAndLiquidMeasure, allowPrefix : false } ,
// area
"ha" : { group : cat goryArea, allowPrefix : true } ,
"uk_acre" : { group : cat goryArea, allowPrefix : false } ,
"us_acre" : { group : cat goryArea, allowPrefix : false } ,
"ang2" : { group : cat goryArea, allowPrefix : true } ,
"ang^2" : { group : cat goryArea, allowPrefix : true } ,
"ar" : { group : cat goryArea, allowPrefix : true } ,
"ft2" : { group : cat goryArea, allowPrefix : false } ,
"ft^2" : { group : cat goryArea, allowPrefix : false } ,
"in2" : { group : cat goryArea, allowPrefix : false } ,
"in^2" : { group : cat goryArea, allowPrefix : false } ,
"ly2" : { group : cat goryArea, allowPrefix : false } ,
"ly^2" : { group : cat goryArea, allowPrefix : false } ,
"m2" : { group : cat goryArea, allowPrefix : true } ,
"m^2" : { group : cat goryArea, allowPrefix : true } ,
"Morgen" : { group : cat goryArea, allowPrefix : false } ,
"mi2" : { group : cat goryArea, allowPrefix : false } ,
"mi^2" : { group : cat goryArea, allowPrefix : false } ,
"Nmi2" : { group : cat goryArea, allowPrefix : false } ,
"Nmi^2" : { group : cat goryArea, allowPrefix : false } ,
"Pica2" : { group : cat goryArea, allowPrefix : false } ,
"Pica^2" : { group : cat goryArea, allowPrefix : false } ,
"Picapt2" : { group : cat goryArea, allowPrefix : false } ,
"Picapt^2" : { group : cat goryArea, allowPrefix : false } ,
"yd2" : { group : cat goryArea, allowPrefix : false } ,
"yd^2" : { group : cat goryArea, allowPrefix : false } ,
"ha" : { group : cat e goryArea, allowPrefix : true } ,
"uk_acre" : { group : cat e goryArea, allowPrefix : false } ,
"us_acre" : { group : cat e goryArea, allowPrefix : false } ,
"ang2" : { group : cat e goryArea, allowPrefix : true } ,
"ang^2" : { group : cat e goryArea, allowPrefix : true } ,
"ar" : { group : cat e goryArea, allowPrefix : true } ,
"ft2" : { group : cat e goryArea, allowPrefix : false } ,
"ft^2" : { group : cat e goryArea, allowPrefix : false } ,
"in2" : { group : cat e goryArea, allowPrefix : false } ,
"in^2" : { group : cat e goryArea, allowPrefix : false } ,
"ly2" : { group : cat e goryArea, allowPrefix : false } ,
"ly^2" : { group : cat e goryArea, allowPrefix : false } ,
"m2" : { group : cat e goryArea, allowPrefix : true } ,
"m^2" : { group : cat e goryArea, allowPrefix : true } ,
"Morgen" : { group : cat e goryArea, allowPrefix : false } ,
"mi2" : { group : cat e goryArea, allowPrefix : false } ,
"mi^2" : { group : cat e goryArea, allowPrefix : false } ,
"Nmi2" : { group : cat e goryArea, allowPrefix : false } ,
"Nmi^2" : { group : cat e goryArea, allowPrefix : false } ,
"Pica2" : { group : cat e goryArea, allowPrefix : false } ,
"Pica^2" : { group : cat e goryArea, allowPrefix : false } ,
"Picapt2" : { group : cat e goryArea, allowPrefix : false } ,
"Picapt^2" : { group : cat e goryArea, allowPrefix : false } ,
"yd2" : { group : cat e goryArea, allowPrefix : false } ,
"yd^2" : { group : cat e goryArea, allowPrefix : false } ,
// information
"byte" : { group : cat goryInformation, allowPrefix : true } ,
"bit" : { group : cat goryInformation, allowPrefix : true } ,
"byte" : { group : cat e goryInformation, allowPrefix : true } ,
"bit" : { group : cat e goryInformation, allowPrefix : true } ,
// speed
"m/s" : { group : cat gorySpeed, allowPrefix : true } ,
"m/sec" : { group : cat gorySpeed, allowPrefix : true } ,
"m/h" : { group : cat gorySpeed, allowPrefix : true } ,
"m/hr" : { group : cat gorySpeed, allowPrefix : true } ,
"mph" : { group : cat gorySpeed, allowPrefix : false } ,
"admkn" : { group : cat gorySpeed, allowPrefix : false } ,
"kn" : { group : cat gorySpeed, allowPrefix : false } ,
"m/s" : { group : cat e gorySpeed, allowPrefix : true } ,
"m/sec" : { group : cat e gorySpeed, allowPrefix : true } ,
"m/h" : { group : cat e gorySpeed, allowPrefix : true } ,
"m/hr" : { group : cat e gorySpeed, allowPrefix : true } ,
"mph" : { group : cat e gorySpeed, allowPrefix : false } ,
"admkn" : { group : cat e gorySpeed, allowPrefix : false } ,
"kn" : { group : cat e gorySpeed, allowPrefix : false } ,
}
// unitConversions maps details of the Units of measure conversion factors,
// organised by group.
var unitConversions = map [ byte ] map [ string ] float64 {
// conversion uses gram (g) as an intermediate unit
cat goryWeightAndMass: {
cat e goryWeightAndMass: {
"g" : 1 ,
"sg" : 6.85217658567918e-05 ,
"lbm" : 2.20462262184878e-03 ,
@ -2333,7 +2333,7 @@ var unitConversions = map[byte]map[string]float64{
"brton" : 9.84206527611061e-07 ,
} ,
// conversion uses meter (m) as an intermediate unit
cat goryDistance: {
cat e goryDistance: {
"m" : 1 ,
"mi" : 6.21371192237334e-04 ,
"Nmi" : 5.39956803455724e-04 ,
@ -2351,7 +2351,7 @@ var unitConversions = map[byte]map[string]float64{
"survey_mi" : 6.21369949494950e-04 ,
} ,
// conversion uses second (s) as an intermediate unit
cat goryTime: {
cat e goryTime: {
"yr" : 3.16880878140289e-08 ,
"day" : 1.15740740740741e-05 ,
"d" : 1.15740740740741e-05 ,
@ -2362,7 +2362,7 @@ var unitConversions = map[byte]map[string]float64{
"s" : 1 ,
} ,
// conversion uses Pascal (Pa) as an intermediate unit
cat goryPressure: {
cat e goryPressure: {
"Pa" : 1 ,
"p" : 1 ,
"atm" : 9.86923266716013e-06 ,
@ -2372,7 +2372,7 @@ var unitConversions = map[byte]map[string]float64{
"Torr" : 7.50061682704170e-03 ,
} ,
// conversion uses Newton (N) as an intermediate unit
cat goryForce: {
cat e goryForce: {
"N" : 1 ,
"dyn" : 1.0e+5 ,
"dy" : 1.0e+5 ,
@ -2380,7 +2380,7 @@ var unitConversions = map[byte]map[string]float64{
"pond" : 1.01971621297793e+02 ,
} ,
// conversion uses Joule (J) as an intermediate unit
cat goryEnergy: {
cat e goryEnergy: {
"J" : 1 ,
"e" : 9.99999519343231e+06 ,
"c" : 2.39006249473467e-01 ,
@ -2396,7 +2396,7 @@ var unitConversions = map[byte]map[string]float64{
"btu" : 9.47815067349015e-04 ,
} ,
// conversion uses Horsepower (HP) as an intermediate unit
cat goryPower: {
cat e goryPower: {
"HP" : 1 ,
"h" : 1 ,
"W" : 7.45699871582270e+02 ,
@ -2404,12 +2404,12 @@ var unitConversions = map[byte]map[string]float64{
"PS" : 1.01386966542400e+00 ,
} ,
// conversion uses Tesla (T) as an intermediate unit
cat goryMagnetism: {
cat e goryMagnetism: {
"T" : 1 ,
"ga" : 10000 ,
} ,
// conversion uses litre (l) as an intermediate unit
cat goryVolumeAndLiquidMeasure: {
cat e goryVolumeAndLiquidMeasure: {
"l" : 1 ,
"L" : 1 ,
"lt" : 1 ,
@ -2452,7 +2452,7 @@ var unitConversions = map[byte]map[string]float64{
"MTON" : 8.82866668037215e-04 ,
} ,
// conversion uses hectare (ha) as an intermediate unit
cat goryArea: {
cat e goryArea: {
"ha" : 1 ,
"uk_acre" : 2.47105381467165e+00 ,
"us_acre" : 2.47104393046628e+00 ,
@ -2480,12 +2480,12 @@ var unitConversions = map[byte]map[string]float64{
"yd^2" : 1.19599004630108e+04 ,
} ,
// conversion uses bit (bit) as an intermediate unit
cat goryInformation: {
cat e goryInformation: {
"bit" : 1 ,
"byte" : 0.125 ,
} ,
// conversion uses Meters per Second (m/s) as an intermediate unit
cat gorySpeed: {
cat e gorySpeed: {
"m/s" : 1 ,
"m/sec" : 1 ,
"m/h" : 3.60e+03 ,
@ -2639,7 +2639,7 @@ func (fn *formulaFuncs) CONVERT(argsList *list.List) formulaArg {
return newNumberFormulaArg ( val / fromMultiplier )
} else if fromUOM == toUOM {
return newNumberFormulaArg ( val / toMultiplier )
} else if fromCategory == cat goryTemperature {
} else if fromCategory == cat e goryTemperature {
return newNumberFormulaArg ( convertTemperature ( fromUOM , toUOM , val ) )
}
fromConversion := unitConversions [ fromCategory ] [ fromUOM ]
@ -13607,7 +13607,7 @@ func (fn *formulaFuncs) replace(name string, argsList *list.List) formulaArg {
if argsList . Len ( ) != 4 {
return newErrorFormulaArg ( formulaErrorVALUE , fmt . Sprintf ( "%s requires 4 arguments" , name ) )
}
oldText, new Text := argsList . Front ( ) . Value . ( formulaArg ) . Value ( ) , argsList . Back ( ) . Value . ( formulaArg ) . Value ( )
sourceText, target Text := argsList . Front ( ) . Value . ( formulaArg ) . Value ( ) , argsList . Back ( ) . Value . ( formulaArg ) . Value ( )
startNumArg , numCharsArg := argsList . Front ( ) . Next ( ) . Value . ( formulaArg ) . ToNumber ( ) , argsList . Front ( ) . Next ( ) . Next ( ) . Value . ( formulaArg ) . ToNumber ( )
if startNumArg . Type != ArgNumber {
return startNumArg
@ -13615,18 +13615,18 @@ func (fn *formulaFuncs) replace(name string, argsList *list.List) formulaArg {
if numCharsArg . Type != ArgNumber {
return numCharsArg
}
oldTextLen, startIdx := len ( old Text) , int ( startNumArg . Number )
if startIdx > old TextLen {
startIdx = old TextLen + 1
sourceTextLen, startIdx := len ( source Text) , int ( startNumArg . Number )
if startIdx > source TextLen {
startIdx = source TextLen + 1
}
endIdx := startIdx + int ( numCharsArg . Number )
if endIdx > old TextLen {
endIdx = old TextLen + 1
if endIdx > source TextLen {
endIdx = source TextLen + 1
}
if startIdx < 1 || endIdx < 1 {
return newErrorFormulaArg ( formulaErrorVALUE , formulaErrorVALUE )
}
result := oldText[ : startIdx - 1 ] + newText + old Text[ endIdx - 1 : ]
result := sourceText[ : startIdx - 1 ] + targetText + source Text[ endIdx - 1 : ]
return newStringFormulaArg ( result )
}
@ -13683,10 +13683,10 @@ func (fn *formulaFuncs) SUBSTITUTE(argsList *list.List) formulaArg {
if argsList . Len ( ) != 3 && argsList . Len ( ) != 4 {
return newErrorFormulaArg ( formulaErrorVALUE , "SUBSTITUTE requires 3 or 4 arguments" )
}
text , old Text := argsList . Front ( ) . Value . ( formulaArg ) , argsList . Front ( ) . Next ( ) . Value . ( formulaArg )
new Text, instanceNum := argsList . Front ( ) . Next ( ) . Next ( ) . Value . ( formulaArg ) , 0
text , source Text := argsList . Front ( ) . Value . ( formulaArg ) , argsList . Front ( ) . Next ( ) . Value . ( formulaArg )
target Text, instanceNum := argsList . Front ( ) . Next ( ) . Next ( ) . Value . ( formulaArg ) , 0
if argsList . Len ( ) == 3 {
return newStringFormulaArg ( strings . ReplaceAll ( text . Value ( ) , oldText. Value ( ) , new Text. Value ( ) ) )
return newStringFormulaArg ( strings . ReplaceAll ( text . Value ( ) , sourceText. Value ( ) , target Text. Value ( ) ) )
}
instanceNumArg := argsList . Back ( ) . Value . ( formulaArg ) . ToNumber ( )
if instanceNumArg . Type != ArgNumber {
@ -13696,10 +13696,10 @@ func (fn *formulaFuncs) SUBSTITUTE(argsList *list.List) formulaArg {
if instanceNum < 1 {
return newErrorFormulaArg ( formulaErrorVALUE , "instance_num should be > 0" )
}
str , old TextLen, count , chars , pos := text . Value ( ) , len ( old Text. Value ( ) ) , instanceNum , 0 , - 1
str , source TextLen, count , chars , pos := text . Value ( ) , len ( source Text. Value ( ) ) , instanceNum , 0 , - 1
for {
count --
index := strings . Index ( str , old Text. Value ( ) )
index := strings . Index ( str , source Text. Value ( ) )
if index == - 1 {
pos = - 1
break
@ -13708,7 +13708,7 @@ func (fn *formulaFuncs) SUBSTITUTE(argsList *list.List) formulaArg {
if count == 0 {
break
}
idx := old TextLen + index
idx := source TextLen + index
chars += idx
str = str [ idx : ]
}
@ -13716,8 +13716,8 @@ func (fn *formulaFuncs) SUBSTITUTE(argsList *list.List) formulaArg {
if pos == - 1 {
return newStringFormulaArg ( text . Value ( ) )
}
pre , post := text . Value ( ) [ : pos ] , text . Value ( ) [ pos + old TextLen: ]
return newStringFormulaArg ( pre + new Text. Value ( ) + post )
pre , post := text . Value ( ) [ : pos ] , text . Value ( ) [ pos + source TextLen: ]
return newStringFormulaArg ( pre + target Text. Value ( ) + post )
}
// TEXTJOIN function joins together a series of supplied text strings into one