summaryrefslogtreecommitdiff
path: root/source/text/sbasic/shared/03120306.xhp
blob: c79b292e5822e915861b7316f6c545db52231614 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
<!--
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->

<meta>
  <topic id="textsbasicshared03120306xml" indexer="include" status="PUBLISH">
    <title id="tit" xml-lang="en-US">Mid Function, Mid Statement [Runtime]</title>
    <filename>/text/sbasic/shared/03120306.xhp</filename>
  </topic>
</meta>

<body>


<section id="mid">
<bookmark xml-lang="en-US" branch="index" id="bm_id3143268">
  <bookmark_value>Mid function</bookmark_value>
  <bookmark_value>Mid statement</bookmark_value>
</bookmark>


<paragraph id="hd_id3143268" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03120306.xhp" name="Mid Function, Mid Statement [Runtime]">Mid Function, Mid Statement [Runtime]</link></paragraph>
<paragraph id="par_id3148473" role="paragraph" xml-lang="en-US">Returns the specified portion of a string expression (<emph>Mid function</emph>), or replaces the portion of a string expression with another string (<emph>Mid statement</emph>).</paragraph>
</section>

<paragraph id="hd_id3154285" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph>
<bascode>
<paragraph id="par_id3147530" role="bascode" xml-lang="en-US">Mid (Text As String, Start As Long [, Length As Long]) or Mid (Text As String, Start As Long , Length As Long, Text As String)</paragraph>
</bascode>

<paragraph id="hd_id3145068" role="heading" level="2" xml-lang="en-US">Return value:</paragraph>
<paragraph id="par_id3149295" role="paragraph" xml-lang="en-US">String (only by Function)</paragraph>

<paragraph id="hd_id3154347" role="heading" level="2" xml-lang="en-US">Parameters:</paragraph>
<paragraph id="par_id3148664" role="paragraph" xml-lang="en-US"> <emph>Text:</emph> Any string expression that you want to modify.</paragraph>
<paragraph id="par_id3150359" role="paragraph" xml-lang="en-US"> <emph>Start: </emph>Numeric expression that indicates the character position within the string where the string portion that you want to replace or to return begins. The maximum allowed value is 65535.<comment>see i17928</comment></paragraph>
<paragraph id="par_id3148451" role="paragraph" xml-lang="en-US"> <emph>Length:</emph> Numeric expression that returns the number of characters that you want to replace or return. The maximum allowed value is 65535.</paragraph>
<paragraph id="par_id3125864" role="paragraph" xml-lang="en-US">If the Length parameter in the <emph>Mid function</emph> is omitted, all characters in the string expression from the start position to the end of the string are returned.</paragraph>
<paragraph id="par_id3144762" role="paragraph" xml-lang="en-US">If the Length parameter in the <emph>Mid statement</emph> is less than the length of the text that you want to replace, the text is reduced to the specified length.</paragraph>
<paragraph id="par_id3150769" role="paragraph" xml-lang="en-US"> <emph>Text:</emph> The string to replace the string expression (<emph>Mid statement</emph>).</paragraph>
<embed href="text/sbasic/shared/00000003.xhp#errorcode"/>
<embed href="text/sbasic/shared/00000003.xhp#err5"/>

<paragraph id="hd_id3149560" role="heading" level="2" xml-lang="en-US">Example:</paragraph>
<bascode>
<paragraph id="par_idm1341563264" role="bascode" localize="false" xml-lang="en-US">Sub ExampleUSDate</paragraph>
<paragraph id="par_idm1341562032" role="bascode" localize="false" xml-lang="en-US">Dim sInput As String</paragraph>
<paragraph id="par_idm1341560800" role="bascode" localize="false" xml-lang="en-US">Dim sUS_date As String</paragraph>
<paragraph id="par_id3153189" role="bascode" xml-lang="en-US"> sInput = InputBox("Please input a date in the international format 'YYYY-MM-DD'")</paragraph>
<paragraph id="par_idm1341557792" role="bascode" localize="false" xml-lang="en-US"> sUS_date = Mid(sInput, 6, 2)</paragraph>
<paragraph id="par_idm1341556544" role="bascode" localize="false" xml-lang="en-US"> sUS_date = sUS_date &amp; "/"</paragraph>
<paragraph id="par_idm1341555280" role="bascode" localize="false" xml-lang="en-US"> sUS_date = sUS_date &amp; Right(sInput, 2)</paragraph>
<paragraph id="par_idm1341554016" role="bascode" localize="false" xml-lang="en-US"> sUS_date = sUS_date &amp; "/"</paragraph>
<paragraph id="par_idm1341552752" role="bascode" localize="false" xml-lang="en-US"> sUS_date = sUS_date &amp; Left(sInput, 4)</paragraph>
<paragraph id="par_idm1341551488" role="bascode" localize="false" xml-lang="en-US"> MsgBox sUS_date</paragraph>
<paragraph id="par_idm1341550256" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph>
</bascode>
</body>

</helpdocument>
-3 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/connectivity/source/manager/mdrivermanager.cxx
AgeCommit message (Collapse)Author
2024-09-12These bogus -Wdangling-reference still hit with current GCC 15 trunkStephan Bergmann
Change-Id: Ice2be2156474cf486ad1c461d65e2711ebf43d2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173232 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-05-15use more officecfg in OSDBCDriverManagerNoel Grandin
Change-Id: I2b1758572a6436d829d547d60bca5fa2d1a3c98f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167641 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2024-05-07loplugin:ostr in connectivityNoel Grandin
Change-Id: Ice633719b05240ab5a052b62ca4eafe89f97e12f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167238 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-04A number of bogus GCC 13 warnings still hit with recent GCC 14 trunkStephan Bergmann
Change-Id: I0ec7743cd79429591fcfc3eb9715ff36d06fc00b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165765 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-27Drop std::as_const from css::uno::Sequence iterationsMike Kaganski
Obsoleted by commit 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and commit fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code, 2021-11-05). Change-Id: Idbafef5d34c0d4771cbbf75b9db9712e504164cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162640 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-13cid#1546354 COPY_INSTEAD_OF_MOVECaolán McNamara
and cid#1546319 COPY_INSTEAD_OF_MOVE cid#1546286 COPY_INSTEAD_OF_MOVE cid#1546283 COPY_INSTEAD_OF_MOVE cid#1546191 COPY_INSTEAD_OF_MOVE cid#1545953 COPY_INSTEAD_OF_MOVE cid#1545874 COPY_INSTEAD_OF_MOVE cid#1545857 COPY_INSTEAD_OF_MOVE cid#1545781 COPY_INSTEAD_OF_MOVE cid#1545765 COPY_INSTEAD_OF_MOVE cid#1545546 COPY_INSTEAD_OF_MOVE cid#1545338 COPY_INSTEAD_OF_MOVE cid#1545190 COPY_INSTEAD_OF_MOVE cid#1545272 COPY_INSTEAD_OF_MOVE cid#1545242 COPY_INSTEAD_OF_MOVE cid#1545229 COPY_INSTEAD_OF_MOVE Change-Id: I88813d9dbd87ce10375db8198028f8b70e23f0fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162027 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-04Replace useless throwNoSuchElementException functionJulien Nabet
by its straightforward and short content. Change-Id: Ic847f12923e71addf00b7b16546c8168cf3952f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157552 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2023-03-15Silence some false -Werror=dangling-referenceStephan Bergmann
...seen at least with gcc-c++-13.0.1-0.7.fc38.x86_64, > connectivity/source/manager/mdrivermanager.cxx: In lambda function: > connectivity/source/manager/mdrivermanager.cxx:621:41: error: possibly dangling reference to a temporary [-Werror=dangling-reference] > 621 | const DriverAccess& ensuredAccess = EnsureDriver(m_xContext)(driverAccess); > | ^~~~~~~~~~~~~ > connectivity/source/manager/mdrivermanager.cxx:621:81: note: the temporary was destroyed at the end of the full expression ‘drivermanager::{anonymous}::EnsureDriver(this->drivermanager::OSDBCDriverManager::m_xContext).drivermanager::{anonymous}::EnsureDriver::operator()((* & driverAccess))’ > 621 | const DriverAccess& ensuredAccess = EnsureDriver(m_xContext)(driverAccess); > | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ and > vcl/source/window/layout.cxx: In function ‘array_type assembleGrid(const VclGrid&)’: > vcl/source/window/layout.cxx:952:30: error: possibly dangling reference to a temporary [-Werror=dangling-reference] > 952 | const GridEntry &rEntry = A[x][y]; > | ^~~~~~ > vcl/source/window/layout.cxx:952:45: note: the temporary was destroyed at the end of the full expression ‘boost::multi_array_ref<T, NumDims>::operator[](index) [with T = {anonymous}::GridEntry; long unsigned int NumDims = 2; reference = boost::detail::multi_array::sub_array<{anonymous}::GridEntry, 1>; index = long int](((boost::multi_array_ref<{anonymous}::GridEntry, 2>::index)x)).boost::detail::multi_array::sub_array<{anonymous}::GridEntry, 1>::operator[](((boost::detail::multi_array::sub_array<{anonymous}::GridEntry, 1>::index)y))’ > 952 | const GridEntry &rEntry = A[x][y]; > | ^ > vcl/source/window/layout.cxx: In function ‘void calcMaxs(const array_type&, std::__debug::vector<VclGrid::Value>&, std::__debug::vector<VclGrid::Value>&)’: > vcl/source/window/layout.cxx:1075:30: error: possibly dangling reference to a temporary [-Werror=dangling-reference] > 1075 | const GridEntry &rEntry = A[x][y]; > | ^~~~~~ > vcl/source/window/layout.cxx:1075:45: note: the temporary was destroyed at the end of the full expression ‘boost::multi_array_ref<T, NumDims>::operator[](index) const [with T = {anonymous}::GridEntry; long unsigned int NumDims = 2; const_reference = boost::detail::multi_array::const_sub_array<{anonymous}::GridEntry, 1, const {anonymous}::GridEntry*>; index = long int](((boost::multi_array_ref<{anonymous}::GridEntry, 2>::index)x)).boost::detail::multi_array::const_sub_array<{anonymous}::GridEntry, 1, const {anonymous}::GridEntry*>::operator[](((boost::detail::multi_array::const_sub_array<{anonymous}::GridEntry, 1, const {anonymous}::GridEntry*>::index)y))’ > 1075 | const GridEntry &rEntry = A[x][y]; > | ^ > vcl/source/window/layout.cxx:1106:30: error: possibly dangling reference to a temporary [-Werror=dangling-reference] > 1106 | const GridEntry &rEntry = A[x][y]; > | ^~~~~~ > vcl/source/window/layout.cxx:1106:45: note: the temporary was destroyed at the end of the full expression ‘boost::multi_array_ref<T, NumDims>::operator[](index) const [with T = {anonymous}::GridEntry; long unsigned int NumDims = 2; const_reference = boost::detail::multi_array::const_sub_array<{anonymous}::GridEntry, 1, const {anonymous}::GridEntry*>; index = long int](((boost::multi_array_ref<{anonymous}::GridEntry, 2>::index)x)).boost::detail::multi_array::const_sub_array<{anonymous}::GridEntry, 1, const {anonymous}::GridEntry*>::operator[](((boost::detail::multi_array::const_sub_array<{anonymous}::GridEntry, 1, const {anonymous}::GridEntry*>::index)y))’ > 1106 | const GridEntry &rEntry = A[x][y]; > | ^ Change-Id: I498bb468ade52f83117c8cf57f8d64697978d9ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148921 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-15Simplify AcceptsURLStephan Bergmann
Change-Id: I14cd7d6bce2d5d5160e21b4fd12dcb77572925b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148922 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-08-18Move tools/diagnose_ex.h to comphelper/diagnose_ex.hxxStephan Bergmann
...so that its TOOLS_WARN_EXCEPTION can be used in comphelper/source/misc/logging.cxx in a follow-up commit. (And while at it, rename from diangose_ex.h to the more appropriate diagnose_ex.hxx. The comphelper module is sufficiently low-level for this immediate use case, so use that at least for now; o3tl might be even more suitable but doesn't have a Library until now. Also, for the immediate use case it would have sufficed to only break DbgGetCaughtException, exceptionToString, TOOLS_WARN_EXCEPTION, TOOLS_WARN_EXCEPTION_IF, and TOOLS_INFO_EXCEPTION out of include/tools/diagnose_ex.h into an additional new include/comphelper/diagnose_ex.hxx, but its probably easier overall to just move the complete include file as is.) Change-Id: I9f3222d4ccf1a9ac29d7eb9ba1530d53e2affaee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138451 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-13clang-tidy modernize-pass-by-value in connectivityNoel Grandin
Change-Id: I1f1b609254c7f8cfba14c248167f81b51684d8e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135727 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-04Just use Any ctor instead of makeAny in connectivityStephan Bergmann
Change-Id: I68e7354f094ee0e673d105dd8770a658810703d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133838 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-12-25oss-fuzz: fix some compiler warningsJan-Marek Glogowski
Some unused functions and variables and many missing HAVE_FEATURE_NSS warnings, because the native-code.py stubs were missing the config_crypto.h header. Change-Id: I88ff7d8f96e7382027a21f205db982fd797bd6af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127392 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2021-12-21Fix typos in mdrivermanager.cxx (connectivity)Julien Nabet
Change-Id: Ib5c115faf0dcff61be806b538c4f93bc16b9928b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127230 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-12-21loplugin:flatten in canvas..cuiNoel Grandin
Change-Id: I208767eaa60d913fe2882403f1f9351eb08256f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127224 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-29Prepare for removal of non-const operator[] from Sequence in connectivityMike Kaganski
Change-Id: If92f9af5e248f4b066359fe043adf221102e8561 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124353 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-06loplugin:moveparam in connectivityNoel Grandin
Change-Id: Iaf3a64effb69fd82c6303d8fa75723ccc5ced543 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123183 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-24some prerequisites to use dbase import with config unavailableCaolán McNamara
Change-Id: I0a7f32a69112d7ce9ffc39481154c9da346c8d24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122544 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-08-02convert #defines to OUStringLiteralNoel Grandin
mostly by doing $ git grep -l '#define.*\"' -- *.cxx | xargs perl -pi -e 's/^#define\s+(\w+)\s+(\".*\")/constexpr OUStringLiteral \1 = u\2;/g' Change-Id: Idface893449b0ef2a3c5254865a300585d752fbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119669 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-03-10Drop 'static_cast<cppu::OWeakObject*>' syntactic noiseMike Kaganski
... a leftover from 96388e5e809a48573970df9b6b2649517a08447f. Change-Id: I909a470612c421472d8bf94f80e3e94ecb51d6e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112257 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-02-17loplugin:referencecasting in connectivityNoel
Change-Id: I4b91c3e4a225323235ea37d77f0f96600bf412be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110969 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-01OSL_FAIL.*exception -> TOOLS_WARN_EXCEPTIONNoel
Change-Id: I6800e23ead2767d245d5da71d2d40e0f8a6d7e1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106859 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-21Fix typosAndrea Gelmini
Change-Id: Ia66e31a0ad71dde1a6c1caa911d6083e1fb9eb61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104538 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2020-10-01Use the new single-instance="true" attribute in connectivityStephan Bergmann
Change-Id: Ie49207b659214163f2f57051ac8f9de02fab36c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103735 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-13Remove some unused includesMiklos Vajna
Change-Id: Iea6b931b1f2328886354f70ad81a3e07367db717 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100669 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-08-01connectivity/sdbc2: create instances with uno constructorsNoel Grandin
See tdf#74608 for motivation Change-Id: I707b0e506aa152ec104e677dc09968c2dc1ac9fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98422 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>