{"title":"BigText.TextPos(Text) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/bigtext/bigtext-textpos-method/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/bigtext/bigtext-textpos-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/bigtext/bigtext-textpos-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Gets the position at which a specific string first occurs in this BigText instance.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":144,"chars":64},{"level":2,"title":"Parameters","slug":"parameters","at":208,"chars":233},{"level":2,"title":"Return Value","slug":"return-value","at":441,"chars":139},{"level":2,"title":"Remarks","slug":"remarks","at":580,"chars":68},{"level":2,"title":"Example 1","slug":"example-1","at":648,"chars":767},{"level":2,"title":"Example 2","slug":"example-2","at":1415,"chars":339},{"level":2,"title":"Example 3","slug":"example-3","at":1754,"chars":342},{"level":2,"title":"Related information","slug":"related-information","at":2096,"chars":135}],"text":"> Version: _Available or changed with runtime version 1.0._\nGets the position at which a specific string first occurs in this BigText instance.\n## Syntax\n```al\nPosition :=   BigText.TextPos(String: Text)\n```\n## Parameters\nBigText\nType: bigtext-data-type\nAn instance of the bigtext-data-type data type.\nString\nType: ../text/text-data-type\nThe text string to search for in the BigText variable. If this parameter is empty, then 0 is returned.\n## Return Value\nPosition\nType: ../integer/integer-data-type\nThe position at which a specific string first occurs in this BigText instance.\n## Remarks\nThe first character in a BigText variable is position 1.\n## Example 1\nThe following examples show how to use the bigtext-textpos-method. These examples require that you create the following global variables and text constant.\n```al\nvar\n    MyBigText: BigText;\n    VarPosition: Text;\n    Text000: Label 'VarPosition = %1';\n```\nThe following examples first initialize the content of the BigText variable with the text ABCDEFG.\nIn this example, the first occurrence of the character B \\(the first character of the specified text\\) is found in the second position in the MyBigText variable so the method returns 2. The return value is stored in the variable VarPosition and displayed in a message box.\n```al\nMyBigText.AddText('ABCDEFG');\nVarPosition := MyBigText.TextPos('BCD'); // Returns 2.\nMessage(Text000, VarPosition);\n```\n## Example 2\nIn the following example, the method returns 0 because the specified string is not found in the MyBigText variable. The return value is stored in the variable VarPosition and displayed in a message box.\n```al\nMyBigText.AddText('ABCDEFG');\nVarPosition := MyBigText.TextPos(''); // Returns 0.\nMessage(Text000, VarPosition);\n```\n## Example 3\nIn the following example, the method returns 0 because the specified string is not found in the MyBigText variable. The return value is stored in the variable VarPosition and displayed in a message box.\n```al\nMyBigText.AddText('ABCDEFG');\nVarPosition := MyBigText.TextPos('XYZ'); // Returns 0.\nMessage(Text000, VarPosition);\n```\n## Related information\nbigtext-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}