Math.TextToNumber
-----------------

Converts a text to a number.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Math](component_Math.md) | [2.9](newinversion29.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Math.TextToNumber"; Text { ; detect } ) 

**MBS**( **"Math.TextToNumber";** /\* Converts a text to a number. \*/  
**$Text**; /\* Some text value where you want to get the number back.e.g. "123.456" \*/   
**$detect**) /\* Optional; Pass 1 to detect comma vs. dot and interpret number right.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Text | Some text value where you want to get the number back. | "123.456" |  |
| detect | Pass 1 to detect comma vs. dot and interpret number right. | 1 | Optional |

### Result

Returns number.

### Description

Converts a text to a number.  
This function always uses english system (dot as decimal separator).  
  
You may need to round number if needed.  
### Examples

Detect that number has dot as decimal divider and read number:

 MBS ("Math.TextToNumber"; "123,456.789 "; 1)  
Detect that number has comma as decimal divider and read number:

 MBS ("Math.TextToNumber"; "123.456 ,789"; 1)  
### See also

- [DynaPDF.FindText](DynaPDFFindText.md)
- [DynaPDF.GetImportPageBounds](DynaPDFGetImportPageBounds.md)
- [DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)
- [DynaPDF.Rectangle](DynaPDFRectangle.md)
- [GMImage.FontTypeMetrics](GMImageFontTypeMetrics.md)
- [Math.DecodeNumber](MathDecodeNumber.md)
- [Math.NumberToText](MathNumberToText.md)

### Example Databases

- [DynaPDF/Add Weblinks](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Add%20Weblinks.shtml#3ScriptAnchor_)
- [DynaPDF/Convert to 2 Pages](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Convert%20to%202%20Pages.shtml#4ScriptAnchor_)
- [DynaPDF/Form/Form](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Form/Form.shtml#3ScriptAnchor_)
- [DynaPDF/List Annotations](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/List%20Annotations.shtml#2ScriptAnchor_)
- [GraphicsMagick/Text Wrap](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Text%20Wrap.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Advent calendar - Door 6 - Sending Out Wishlist Forms](https://www.mbsplugins.de/archive/2024-12-06/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [Adding cutting lines for PDF in FileMaker](https://www.mbsplugins.de/archive/2021-01-04/Adding_cutting_lines_for_PDF_i/monkeybreadsoftware_blog_filemaker)
- [Example Script for DynaPDF.FindText and DynaPDF.WebLink](https://www.mbsplugins.de/archive/2020-05-04/Example_Script_for_DynaPDFFind/monkeybreadsoftware_blog_filemaker)
- [Create two page PDF document in FileMaker](https://www.mbsplugins.de/archive/2019-08-22/Create_two_page_PDF_document_i/monkeybreadsoftware_blog_filemaker)
- [PDF Forms with MBS Plugin](https://www.mbsplugins.de/archive/2018-04-21/PDF_Forms_with_MBS_Plugin/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.1pr1](https://www.mbsplugins.de/archive/2015-03-16/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 2.9pr1](https://www.mbsplugins.de/archive/2012-08-14/MBS_Filemaker_Plugin_version_2/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 1/2022, Seite 20](https://filemaker-magazin.de/neuigkeit/4172-Appetithappen-FMM_202201)

This function is free to use.

Created 18th August 2014 , last changed 27th October 2023

  
[Math.Sum](MathSum.md) - [Matrix.Add](MatrixAdd.md)

[HTML Version](MathTextToNumber.shtml)